DateContinuousAxis Grid Labels

4 posts, 0 answers
  1. KA
    KA avatar
    7 posts
    Member since:
    Jan 2013

    Posted 29 Aug 2015 Link to this post

    Hi

    I would like to ask if there is an easy solution to create a grid on the x-axis of a datecontinuous axis.

    e.g. every x second/minute/hour depending on the total timespan shown in the chart there will be a tick/grid line. independent if there exist a value for that specific datetime

     thanks for your help!

     

  2. Anna
    Admin
    Anna avatar
    99 posts

    Posted 01 Sep 2015 Link to this post

    Hi Kumar,

    You can check out the article on CartesianChartGrid and PolarChartGrid which has information and samples on how to include a grid into your plot area.

    The default behavior of the DateTimeContinuous axis is to include ticks at even intervals independent of whether there exist a corresponding value in the view models for this date or not. If you would like to control this interval, you can use the MajorStep and the MajorStepUnit properties of the axis. For example if you would like to have a gridline/tick for each month, your xaml would look like this:

    <telerik:DateTimeContinuousAxis LabelFitMode="MultiLine" MajorStepUnit="Month" MajorStep="1" LabelFormat="MMM yyyy"/>

    I hope this helps.

    Regards,
    Anna
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. KA
    KA avatar
    7 posts
    Member since:
    Jan 2013

    Posted 05 Sep 2015 in reply to Anna Link to this post

    Hi Anna,

     thanks for your post

     I have a timebar connected to a chartview. ​Depending on the selected timespan in  the timebar the chartview is updated. The timebar can display up to years of sensordata which interval in 500 milliseconds. The data is sampled with chartdatasource. It is also possible to zoom into the timebar, which leads to more detailed representation of the data.

    Now i would like to

    1) always show a minimum count of labels

    2) add annotations which show the timespan between the axis-ticks and if possible time elapsed after visiblerange.min

     

    thanks

    KA

     

    I found a similar approach at here but there the

     

  5. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 09 Sep 2015 Link to this post

    Hello Kumar,


    1) always show a minimum count of labels

    As Anna explained earlier, you can use the MajorStepUnit and MajorStep properties of the axis. When you make a selection in the timebar, you need to take a look at the selected range and decide whether the step unit should be days, months, years or else. In the method in which you decide the step unit and the step, you can include logic so that a minimum number of labels is shown. For example if the selected range is 2.5 years and you require at least 5 labels, you should not use Year because it would leave you with two labels, you can use either Quarter or Month step unit.

    2) add annotations which show the timespan between the axis-ticks and if possible time elapsed after visiblerange.min
    I am a little unsure where you want to add this annotation. You can use the Annotations property of the chart if you need to add chart annotations. The chart annotations are usually some visuals in the plot area which emphasize data and so are data dependent. What you seem to need is not such an annotation, because it is not related to specific data.

    You shouldn't have any problems with the content of this annotation - since you manually set the step unit and step, you know what is the distance between two ticks.

    Regards,
    Petar Marchev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top