Linear DateTimeCategoricalAxis & LineSeries Dock Problem

3 posts, 0 answers
  1. jed
    jed avatar
    9 posts
    Member since:
    Feb 2012

    Posted 15 Aug 2013 Link to this post

    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. jed
    jed avatar
    9 posts
    Member since:
    Feb 2012

    Posted 17 Aug 2013 Link to this post

    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);


  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 20 Aug 2013 Link to this post

    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 >>
Back to Top