Kendo Chart - Y Axis step range problem

7 posts, 0 answers
  1. aykut
    aykut avatar
    7 posts
    Member since:
    Jan 2015

    Posted 15 Jan 2015 Link to this post

    I have this problem, with Kendo Chart's y axis. I have two different data on it, one varies little, and has a range between 0-20, whereas other value has a way greater difference towards negative side of the y axis. You can see this problem on the included image. I do not get this issue when I have a large difference of the second data type towards positive side of the y axis, but when it is directed to the negative side, the ranges between steps and the number of steps of y-axis gets crazy.

    You can see the difference on the images I have attached.

    I couldn't find any solution to this problem, please help me with this.
    Thanks
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 19 Jan 2015 Link to this post

    Hi,

    I couldn't quite reproduce quite the same output in a simplified sample in the dojo.
    It looks like the automatic setting of yAxis.majorUnit doesn't behave very well, but I can't confirm.

    Can you please share the chart configuration and test data?

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. UI for ASP.NET AJAX banner
  4. aykut
    aykut avatar
    7 posts
    Member since:
    Jan 2015

    Posted 03 Feb 2015 in reply to T. Tsonev Link to this post

    Hi there,

    Sorry for the late reply,

    I am too busy to implement this problem on a sample, but the following is my axis configuration;

    axisOpts: {
        majorGridLines: {
            step: 2
        },
        labels: {
            step: 2
        },
        axisCrossingValue: -Number.MAX_VALUE
    }
    Problem only happens when the data is varying between a large negative value and with any positive value in that same source, you can see that on the images I have attached to the first post. I need a solution for this asap. 
    Thanks!










  5. aykut
    aykut avatar
    7 posts
    Member since:
    Jan 2015

    Posted 03 Feb 2015 in reply to T. Tsonev Link to this post

    I should also add that we have been using this code snippet for a while;

    kendo.dataviz.NumericAxis.fn.initDefaults = function() {
                var defaults = initDefaults.apply(this, arguments);
                defaults.max = Math.max(10, defaults.max);
                defaults.majorUnit = defaults.max / 10;

                return defaults;
    };
  6. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 05 Feb 2015 Link to this post

    Hello,

    Try removing this snippet. Does it make any difference?

    Perhaps you can fine tune the majorUnit calculation in the snippet if you decide to use it.

    I hope this helps.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  7. aykut
    aykut avatar
    7 posts
    Member since:
    Jan 2015

    Posted 05 Feb 2015 in reply to T. Tsonev Link to this post

    Hello again,

    When I remove this snippet, it does fix my issue, but I have remembered why have I used this code. 
    It is to fix the issue that can be seen on the image that I have attached on this post. 
    I either get this bug, or the one in my first post. How can I get rid of them both?    

    Thanks

    p.s. The issue with the attached image is that I have zero valued data sources, but still have full length bars, with really problematic looking axis with five zeroes on it.
  8. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 09 Feb 2015 Link to this post

    Hi,

    Perhaps what you're seeing is the last screenshot is data points withing 0-1 the range.
    If the labels are formatted as "N" the fractional digits will be truncated and you'll only see zeroes on the axis.

    The snippets gets around this by limiting the max value to 10 and the label step (major unit) to 1.
    We can fine tune this to avoid selecting too small major unit:
    kendo.dataviz.NumericAxis.fn.initDefaults = function() {
        var defaults = initDefaults.apply(this, arguments);
        defaults.max = Math.max(10, defaults.max);
        defaults.majorUnit = Math.max(10, defaults.max / 10);

        return defaults;
    };


    You can take this further and insert more complex logic here.
    Try it with different data set to see how it looks.

    I hope this helps.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
UI for ASP.NET AJAX banner