1
votes

I want to do a grouping on my chart, and display my data grouped by weeks. So, the x-axis should be something like "week 23 - year 2014". The data from the controller looks something like this:

[[33, 1, 2014], [32, 1, 2014], [31, 1, 2014], [25, 1, 2014], [16, 1, 2014], [14, 1, 2014], [10, 1, 2014], [8, 1, 2014]]

The first field represents the x-axis week number.I tried the transform function, but it doesn't work. Can you please help me display like a fake x-axis which should say the week number concatenated with the year value?

Thank you.

1
Take your first array [33, 1, 2014], the 33 is the week? The 1 represents what? I understand that 2014 is the year. - Mark

1 Answers

0
votes

Have you tried playing with tickformattter?

I use this to show milloisecond on date:

xaxis: {
                mode: "time",
                timezone: "utc",   // browser
                tickFormatter: function (value, axis) {
                    var d = new Date(value);
                    return d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "." + d.getMilliseconds();
                } ,
                zoomRange: [0.1, 3600000000],
                panRange: [minDateTxt, maxDateTxt]
            },

value is the x value you send to the graph. So if you send week nr it will be something like this:

tickFormatter: function (value, axis) {
                        return  "week" +value+ " - year 2014";
                    }

Hope it helps