Reputation: 170
In my Ruby on Rails application , i have the below json and i am displaying the linechart from chartkick. In linechart , it shows previous day's date though date is correct in the json. When i use format it displays the date fully. How we can display only the date in x axis. My json from controller
[["2018-05-27T00:00:00.000Z", #<BigDecimal:558070d10920,'0.3206E2',18(18)>],
["2018-05-29T00:00:00.000Z", #<BigDecimal:558070d10060,'0.23848E3',18(18)>],
["2018-05-30T00:00:00.000Z", #<BigDecimal:558070d0b420,'0.33899E3',18(18)>],
["2018-05-31T00:00:00.000Z", #<BigDecimal:558070d0a548,'0.83962E3',18(18)>]]
Please find the code used
<%= line_chart [name: 'Sales Amount ', data: @daily_sales_debit_data],
xtitle: 'Period',
ytitle: 'Sales Amount',
library: {
vAxis: { format: "currency" },
legend: { position: 'in'},"format":"dd/MM/yy"},
"discrete":true%>
In the graph , it is being displayed as below . how can i format the date being displayed in x axis without time .
2018-05-08T00:00:00.000Z
2018-05-09T00:00:00.000Z
2018-05-14T00:00:00.000Z
2018-05-15T00:00:00.000Z
2018-05-16T00:00:00.000Z
2018-05-18T00:00:00.000Z
2018-05-19T00:00:00.000Z
2018-05-21T00:00:00.000Z
2018-05-22T00:00:00.000Z
2018-05-25T00:00:00.000Z
2018-05-27T00:00:00.000Z
2018-05-29T00:00:00.000Z
2018-05-30T00:00:00.000Z
2018-05-31T00:00:00.000Z
Upvotes: 2
Views: 455