This is a migrated thread and some comments may be shown as answers.

Linear DateTimeCategoricalAxis & LineSeries Dock Problem

2 Answers 118 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
jed
Top achievements
Rank 1
jed asked on 15 Aug 2013, 10:15 PM
Hi,

i have a radChartView docking to a Window (in Designer 600x300px) filled with a DataTable, 5 values with price and Date.

linePrice = new DataTable();
linePrice.Columns.Add("Price", typeof(float));
linePrice.Columns.Add("Date", typeof(DateTime));
 
LineSeries lineSeria = new LineSeries();
radChartView1.Series.Add(lineSeria);

lineSeria.ShowLabels = true;
lineSeria.LabelFormat = "{0:C}";
lineSeria.ValueMember = "Price";
lineSeria.CategoryMember = "Date";
lineSeria.DataSource = linePrice;
 
DateTimeCategoricalAxis categoricalAxis = new DateTimeCategoricalAxis();
categoricalAxis.DateTimeComponent = DateTimeComponent.Day;
categoricalAxis.MajorTickInterval = 1;
categoricalAxis.PlotMode = AxisPlotMode.BetweenTicks;
categoricalAxis.LabelFormat = "{0:dd}.{0:MM}.{0:yyyy}";
 
lineSeria.HorizontalAxis = categoricalAxis;
 


if i resize the Window greater then 600x300px, everything grows correctly but the line is only visible in the 600x300px field (see Images)

And my second problem/wish: i want the Horizontal Axis linear, like this http://www.telerik.com/help/winforms/chartview-axes-linear.html just with Dates. The Dates in the graph are order dates, so i need to visualise if there are much or less time between them.

thanks in advance

using 2013.2.724.40

2 Answers, 1 is accepted

Sort by
0
jed
Top achievements
Rank 1
answered on 17 Aug 2013, 11:04 AM
found the docking Problem:

i used the Example from: http://www.telerik.com/help/winforms/chartview-databinding-binding-to-datatable.html and then add the DateTimeCategoricalAxis

here the simple fix (move radChart1.Series.Add(lineSeria) to the end):
LineSeries lineSeria = new LineSeries();
             
lineSeria.ShowLabels = true;
lineSeria.LabelFormat = "{0:C}";
lineSeria.ValueMember = "Price";
lineSeria.CategoryMember = "Date";
lineSeria.DataSource = linePice;
 
DateTimeCategoricalAxis categoricalAxis = new DateTimeCategoricalAxis();
categoricalAxis.DateTimeComponent = DateTimeComponent.Day;
categoricalAxis.MajorTickInterval = 1;
categoricalAxis.PlotMode = AxisPlotMode.BetweenTicks;
categoricalAxis.LabelFormat = "{0:dd}.{0:MM}.{0:yyyy}";
 
lineSeria.HorizontalAxis = categoricalAxis;
 
radChartView1.Series.Add(lineSeria);


0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Aug 2013, 03:12 PM
Hello Jed,

Thank you for contacting Telerik Support.

As you can find quite useful details in this help article, note that DateTimeCategorical axis is not added by default to Cartesian series. For this reason you will need to create an instance of the DateTimeCategoricalAxis class and assign it to the HorizontalAxis property of the series, before series is added to the chart.  

Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ChartView
Asked by
jed
Top achievements
Rank 1
Answers by
jed
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or