Changing Timeline in Chartkick

461 views Asked by At

I am using Chartkick for visualization of multiple series line chart. The code is below :-

<h1>Multiple Series Line</h1> <div id="chart-4" style="height: 300px;"></div> <script> new Chartkick.LineChart("chart-4", [{"name":"Workout","data":{"2013-02-10 00:00:00 -0800":3,"2013-02-17 00:00:00 -0800":3,"2013-02-24 00:00:00 -0800":3,"2013-03-03 00:00:00 -0800":1,"2013-03-10 00:00:00 -0800":4,"2013-03-17 00:00:00 -0700":3,"2013-03-24 00:00:00 -0700":2,"2013-03-31 00:00:00 -0700":3}},{"name":"Go to concert","data":{"2013-02-10 00:00:00 -0800":0,"2013-02-17 00:00:00 -0800":0,"2013-02-24 00:00:00 -0800":0,"2013-03-03 00:00:00 -0800":0,"2013-03-10 00:00:00 -0800":2,"2013-03-17 00:00:00 -0700":1,"2013-03-24 00:00:00 -0700":0,"2013-03-31 00:00:00 -0700":0}},{"name":"Wash face","data":{"2013-02-10 00:00:00 -0800":0,"2013-02-17 00:00:00 -0800":1,"2013-02-24 00:00:00 -0800":0,"2013-03-03 00:00:00 -0800":0,"2013-03-10 00:00:00 -0800":0,"2013-03-17 00:00:00 -0700":1,"2013-03-24 00:00:00 -0700":0,"2013-03-31 00:00:00 -0700":1}},{"name":"Call parents","data":{"2013-02-10 00:00:00 -0800":5,"2013-02-17 00:00:00 -0800":3,"2013-02-24 00:00:00 -0800":2,"2013-03-03 00:00:00 -0800":0,"2013-03-10 00:00:00 -0800":0,"2013-03-17 00:00:00 -0700":1,"2013-03-24 00:00:00 -0700":1,"2013-03-31 00:00:00 -0700":0}},{"name":"Eat breakfast","data":{"2013-02-10 00:00:00 -0800":3,"2013-02-17 00:00:00 -0800":2,"2013-02-24 00:00:00 -0800":1,"2013-03-03 00:00:00 -0800":0,"2013-03-10 00:00:00 -0800":2,"2013-03-17 00:00:00 -0700":2,"2013-03-24 00:00:00 -0700":3,"2013-03-31 00:00:00 -0700":0}}]); </script>

and the output of the script is-

enter image description here

Now my question is i am able to edit everything in the chart but i can't change the time line of the chart. Like the time line present in current graph = [15 Feb 2013, 22 Feb 2013, 1 Mar 2013, 8 Mar 2013, 15 Mar 2013, 22 Mar 2013, 29 Mar 2013]
I want to change the current time line in the form like = [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]

1

There are 1 answers

1
monu dwivedi On BEST ANSWER

I haven't used Chartkick... But for the same requirement i have used dviz-master api and achieved my requirement... The code is given below-

Line chart

<pre><code>
Name, cat-A,cat-B , cat-C
Jan, 1, 2, 3
Feb, 4, 5, 6
Mar, 7, 8, 9
</code></pre>
<p><code>(@line)</code></p>



and the output will be like

enter image description here