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

Double X axis on Line chart

3 Answers 185 Views
Charts
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 19 Feb 2012, 06:07 AM
How can I make a X axis like this 

          |
          |
          |
          |
_____|______________________________________________________________________________________________
Month 1 2 3 4 5 6 7 8 9 10 11 12  1 2 3 4 5 6 7 8 9 10 11 12  1 2 3 4 5 6 7 8 9 10 11 12  1 2 3 4 5 6 7 8 9 10 11 12 
Year               2009                                    2010                                   2011                                      2012

This means a double line axis one for month and other for year

Thanks

John K

3 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 20 Feb 2012, 05:55 PM
Hello,

The upcoming release of Kendo DataViz adds support for multiple axes. This solves the problem, but only to some extent, as it still lacks support for a date axis.

We can work around this by using a scatter chart and represent the time as milliseconds. This is demonstrated here.

Here's a modified version with dual axes that will work only with the upcoming Q1'12 Beta and later versions:

$(function() {
    var timePerDay = 1000 * 60 * 60 * 24;

    var data = [{
        price: 10,
        date: Date.parse("2012-02-20")
    }, {
        price: 20,
        date: Date.parse("2012-10-25")
    }, {
        price: 15,
        date: Date.parse("2014-11-29")
    }];

    $("#container").kendoChart({
        legend: {
            visible: false
        },
        dataSource: data,
        series: [{
            type: "scatterLine",
            xField: "date",
            yField: "price"
        }],
        xAxis: [{
            min: Date.parse("2012-01-01"),
            max: Date.parse("2015-01-01"),
            majorUnit: timePerDay * 31,
            labels: {
                template: "#= new Date(value).getMonth() + 1 #"
            }
        }, {
            name: "secondary",
            min: Date.parse("2012-01-01"),
            max: Date.parse("2015-01-01"),
            majorUnit: timePerDay * 365,
            labels: {
                template: "#= new Date(value).getFullYear() #"
            }
        }],
        yAxis: {
            labels: {
                format: "${0:N}"
            }
        }
    });
});



The beta release should be available in around two weeks. Thank you for your patience.

All the best,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Monique
Top achievements
Rank 1
answered on 17 Apr 2012, 09:01 PM
Hello

If I want do this but  for the current  month

I did something like this


But my problem is that the serie  appear  on 1 and 2
instead 10 and 11...


Have a nice day


M.
0
Monique
Top achievements
Rank 1
answered on 17 Apr 2012, 09:02 PM
Hello

If I want do this but  for the current  month

I did something like this


But my problem is that the serie  appear  on 1 and 2
instead 10 and 11...


Have a nice day


M.
Tags
Charts
Asked by
John
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Monique
Top achievements
Rank 1
Share this question
or