google line-chart api for haxis for date

荒凉一梦 提交于 2019-12-11 01:36:27

问题


I am having a list of data update daily based.

data.addColumn('date', 'Date');
    data.addColumn('number', 'Calorie');
    data.addRows([
      [new Date(2012,7,1),  400],
      [new Date(2012,7,2),  460],

the date will increase for 3 months is there any way for me to display only 1st day of the month in the haxis.

                        hAxis: {
                        gridlines:{count:3, color: 'white'},
                        minValue: new Date(2012, 1, 31),
                        maxValue: new Date(2012, 9, 30),
                        showTextEvery:30,
            format:'d-MMM',
                    },

that is my current haxis api code. it somehow display only 1-Aug.


回答1:


To get the result as your wish comment the showTextEvery property in options object.

hAxis: {
    gridlines:{count:3, color: 'white'},
    minValue: new Date(2012, 1, 31),
    maxValue: new Date(2012, 9, 30),
    // showTextEvery:30,
    format:'d-MMM'
} 

Take a look at this jqfaq.com site,it has Google charts related faqs. It may be helpful to you.



来源:https://stackoverflow.com/questions/14150233/google-line-chart-api-for-haxis-for-date

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!