Home › Forums › WinForms controls › Xceed Chart for WinForms › how can i use StandardAxis.PrimaryX by datetime in bar chart
-
AuthorPosts
-
#19056 |
Hello,i want use chart for multi -Series, a line and a bar ,and want StandardAxis.PrimaryX is date like this 2008 8 menas yyyy mm thanks very much
Imported from legacy forums. Posted by Hot (had 3312 views)
Here is an code snippet showing a basic implementation (assuming you have dropped a ChartControl on the designer) :
Chart
chart = chartControl1.Charts[ 0 ];
chart.Axis(
StandardAxis.PrimaryX ).ScaleMode = AxisScaleMode.DateTime;
chart.Axis(
StandardAxis.PrimaryX ).ValueFormatting.Format = ValueFormat.CustomDateTime;
chart.Axis(
StandardAxis.PrimaryX ).ValueFormatting.CustomFormat = “yyyy MM”;
chart.Axis(
StandardAxis.PrimaryX ).StaggerTexts = true;
chart.Axis(
StandardAxis.PrimaryX ).StaggerLevels = 3;
LineSeries line = ( LineSeries )chart.Series.Add( SeriesType.Line );
line.Name = “Line 1”;
line.UseXValues = true;
line.MultiLineMode = MultiLineMode.Series;
line.AddXY( 20,
new DateTime( 2008, 1, 1 ).ToOADate() );
line.AddXY( 40,
new DateTime( 2008, 3, 1 ).ToOADate() );
line.AddXY( 30,
new DateTime( 2008, 5, 1 ).ToOADate() );
line.AddXY( 10,
new DateTime( 2008, 7, 1 ).ToOADate() );
LineSeries
line1 = ( LineSeries )chart.Series.Add( SeriesType.Line );
line1.Name =
“Line 2”;
line1.UseXValues =
true;
line1.MultiLineMode =
MultiLineMode.Series;
line1.AddXY( 50,
new DateTime( 2008, 2, 1 ).ToOADate() );
line1.AddXY( 40,
new DateTime( 2008, 4, 1 ).ToOADate() );
line1.AddXY( -10,
new DateTime( 2008, 6, 1 ).ToOADate() );
line1.AddXY( 20,
new DateTime( 2008, 8, 1 ).ToOADate() );
Imported from legacy forums. Posted by André (had 303 views)
but I want is a line and a bar ,I try to meke bar property of “UseXValues” but there isn’t this property!How can i do that?
Imported from legacy forums. Posted by Hot (had 413 views)
I have finish it by add
axis.Labels.Add(“2008 1”);
but thanks also!
hope help other people
Imported from legacy forums. Posted by Hot (had 4183 views)
-
AuthorPosts
- You must be logged in to reply to this topic.