Hello!
I am new to the chart control and I have some questions.
I have created a simple data table to act as data source. It contains 3 columns, Label, Sales and Budget. The Label column is used as Labels on the x-axis.
1. How do I change the name of the Columns? What I mean is the name showed in the legend. Sales, Budget are english names and I would like to localize.
These names also showed up on the x-axis but I found a way to hide those labels.
2. Can I increase the gap between the vertical x-axis labels and the chart itself? I think that the labels are a bit close.
3. Is 0 the standard min value of the y-axis or do I have to change this to be sure in the future.?
4. How can I change the format of the values showing up when I run a the mouse over a column. The Y-axis was created using this code:
gantSalesBudget.Axis.Y.Labels.ItemFormatString =
"<DATA_VALUE:### ### ##0> sek"
Thanks!
Since I am not using the labels it doesn't have the right effect. But I found out that their is a similar property for the SeriesLabels, and that did the trick.
So I guess you solved it ;-)
/Henrik
Hello Zlatan,
Each axis on the chart has a padding property which you can use to set a distance between the axis and the labels. This will be move labels further away from the rest of the primitives. For example the months on your chart will be 25 pixels away from the x axis by using the following line of code,
this.ultraChart1.Axis.X.Labels.Layout.Padding = 25;
Let me know if you have any questions regarding this matter.
Hello Michael!
No, I don't think it helps since I am not showing the labels.
Here is my code:
Try
'
' DataSource
gantSalesBudget.DataSource = GetProjectSalesBudgetDataSource()
gantSalesBudget.Data.UseRowLabelsColumn = True
gantSalesBudget.Data.RowLabelsColumn = 0
gantSalesBudget.Data.ZeroAligned = True
' Chart
gantSalesBudget.Border.Thickness = 0
' X-Axis
gantSalesBudget.Axis.X.Labels.Visible = False
gantSalesBudget.Axis.X.Extent = 40
gantSalesBudget.Axis.X.MajorGridLines.Visible = False
' Y-Axis
gantSalesBudget.Axis.Y.Labels.ItemFormatString = "<DATA_VALUE:### ### ##0> " & RH.GetStr("Software_Currency")
gantSalesBudget.Axis.Y.Margin.Far.Value = System.Convert.ToDouble(8)
gantSalesBudget.Axis.Y.Margin.Near.Value = System.Convert.ToDouble(0)
gantSalesBudget.Axis.Y.MajorGridLines.Visible = True
' Tooltips
gantSalesBudget.Tooltips.FormatString = "<DATA_VALUE:### ### ##0> " & RH.GetStr("Software_Currency")
' Legend
gantSalesBudget.Legend.Visible = True
gantSalesBudget.Legend.Location = Infragistics.UltraChart.Shared.Styles.LegendLocation.Bottom
gantSalesBudget.Legend.SpanPercentage = 8
gantSalesBudget.Legend.BorderThickness = 0
Console.WriteLine("InitSalesBudget")
Catch ex As Exception
MsgBox("InitSalesBudget")
End Try
The first column in my data source is the name of the months that shows up as "values" below the x-axis.
Any other ideas?
Henrik,
You can add some space at the end of the format string. Try something like this:
UltraChart chart = new UltraChart(); chart.Dock = DockStyle.Fill;
chart.Data.DataSource = new int[] { 1, 2, 3, 4, 5 }; chart.Data.ZeroAligned = true;
chart.Axis.X.Labels.ItemFormatString = "<ITEM_LABEL> "; chart.Axis.X.Labels.SeriesLabels.Visible = false;
Controls.Add(chart);
Let me know if that works for you.
The only thing that I haven't figured out is the spacing between the X-Axis and the labels.
The other questions are solved I think...
Could you describe you idea again, and the properties that I should change in order to get the right appearance...?
/H