Home › Forums › WinForms controls › Xceed Chart for WinForms › Chart and multi data source
-
AuthorPosts
-
You can only mimic the DateTime scale when using a BarSeries. It is always a DimensionScale. Set the AutoLabels to false, and for each DataPoint you add, set the corresponding Label on the X axis to the date of this DataPoint.
Imported from legacy forums. Posted by André (had 577 views)
can you explain this statment: “and for each DataPoint you add, set the corresponding Label on the X axis to the date of this DataPoint”.
I try to add the dates but the displayed dates are from 1899 to 1900
Imported from legacy forums. Posted by nadav (had 1056 views)
Here is a code snippet showing how to do this :
Chart chart = chartControl1.Charts[ 0 ];
BarSeries bar = ( BarSeries )chart.Series.Add( SeriesType.Bar );
bar.Add( 10 );
bar.Add( 40 );
bar.Add( 20 );
bar.Add( 30 );
chart.Axis(
StandardAxis.PrimaryX ).DimensionScale.AutoLabels = false;
chart.Axis(
StandardAxis.PrimaryX ).StaggerTexts = true;
chart.Axis(
StandardAxis.PrimaryX ).StaggerLevels = 2;
chart.Axis(
StandardAxis.PrimaryX ).Labels.Add( new DateTime( 2008, 01, 10 ).ToShortDateString() );
chart.Axis(
StandardAxis.PrimaryX ).Labels.Add( new DateTime( 2008, 01, 15 ).ToShortDateString() );
chart.Axis(
StandardAxis.PrimaryX ).Labels.Add( new DateTime( 2008, 01, 20 ).ToShortDateString() );
chart.Axis(
StandardAxis.PrimaryX ).Labels.Add( new DateTime( 2008, 01, 25 ).ToShortDateString() );
Imported from legacy forums. Posted by André (had 552 views)
Thanks but still it’s not seen so good see the image.what cabe be done in this case.
Imported from legacy forums. Posted by nadav (had 1030 views)
You could add actual values only under the corresponding bars being shown, and leave the others as empty strings (but you have to add them, so the collection of labels has the same number of elements than the collection of DataPoints).
Imported from legacy forums. Posted by André (had 459 views)
Hi.
How can I know the number of elements in the collection of DataPoints
Thanks Nadav
Imported from legacy forums. Posted by nadav (had 1274 views)
bar.Values.Count
Imported from legacy forums. Posted by André (had 3456 views)
-
AuthorPosts
- You must be logged in to reply to this topic.