Chart DateTimeCategoricalAxis

8 posts, 1 answers
  1. Itamar
    Itamar avatar
    17 posts
    Member since:
    Mar 2016

    Posted 19 Dec 2016 Link to this post

    Hello, I need to set the horizontal date axis 

    to display either 6 hours ticks or date ticks.

    The label format should change like in the attached file.

    We want to set the zoom behavior to zoom-in to 15 days

    Appreciate Help

  2. Victor
    Admin
    Victor avatar
    1358 posts

    Posted 21 Dec 2016 Link to this post

    Hi Itamar,

    Thanks for writing.
    You can achieve this by using the axis.LabelValueToStringConverter property. A simple label format will not suffice because it can't decide when to display the month and when the hours.
    The converter should look like something this:

    public class Converter : Java.Lang.Object, IFunction
        {
            public Java.Lang.Object Apply(Java.Lang.Object p0)
            {
                MajorTickModel tick = (MajorTickModel)p0;
     
                // Use the collection index to get the correct date from your data.
                // Then you can return the correct string based on that date.
                return tick.CollectionIndex().ToString();
            }
        }

    Can you please explain what you mean by zoom in to 15 days? Is that a max zoom or data drill down. Our chart currently does not support data drill down if this is what you need.

    Regards,
    Victor
    Telerik by Progress
    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. Itamar
    Itamar avatar
    17 posts
    Member since:
    Mar 2016

    Posted 28 Dec 2016 in reply to Victor Link to this post

    Hello


    We have data of 60 days each point is an hour 
    We want to display be default only 15 days 
    We use ChartPanAndZoomBehavior ,SetZoomToChart method
    The scaleX = 4 , scaleY =0, the zoom is working good but the chart display the last 15 days.
    How can we pan to the most recent 15 days ?

    Thanks

  4. Victor
    Admin
    Victor avatar
    1358 posts

    Posted 03 Jan Link to this post

    Hello Itamar,

    Thanks for writing.
    This should be really simple. You can calculate the pan based on the chart plot area size. You can get the plot area like this:
    chart.PlotAreaClip.Width;
    Then based on the width and your zoom factor you can set the pan offset. Please note that the offset must be a negative value because the chart contents need to move to the left if are to see the right-most (latest) data points.

    Regards,
    Victor
    Telerik by Progress
    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
  5. Itamar
    Itamar avatar
    17 posts
    Member since:
    Mar 2016

    Posted 09 Jan in reply to Victor Link to this post

    Hi Victor,

    I use the SetPanOffsetToChart method without any success. See code below:

     var pw = Chart.PlotAreaClip.Width;      
    _pzBehavior.SetZoomToChart(MaxDays / DefaultDays, 0,0 , 0);
    _pzBehavior.SetPanOffsetToChart(-pw* MaxDays / DefaultDays, 0);

    It seems like the pan value is too bigger then the chart width.

    Do I do something wrong?

     

    Thanks,

    Roey.

     

  6. Answer
    Victor
    Admin
    Victor avatar
    1358 posts

    Posted 11 Jan Link to this post

    Hi Itamar,

    Thanks for writing. Please try this:
    double zoom = 3;
    chart.SetZoom(3, 1);
    double panOffset = chart.PlotAreaClip.Width * zoom;
    chart.SetPanOffset(-panOffset, 0);

    The difference is that the zoom and pan are set on the chart itself, not the behavior.

    Regards,
    Victor
    Telerik by Progress
    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
  7. Itamar
    Itamar avatar
    17 posts
    Member since:
    Mar 2016

    Posted 12 Jan in reply to Victor Link to this post

    Hi Victor,

    Thanks alot. It works :-)

  8. Victor
    Admin
    Victor avatar
    1358 posts

    Posted 12 Jan Link to this post

    Excellent!

    Let us know if you need further assistance.
    Meanwhile I'll fix the zoom reset.

    Regards,
    Victor
    Telerik by Progress
    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