google line-chart api for haxis for date

2019-07-19 03:02发布

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条回答
我想做一个坏孩纸
2楼-- · 2019-07-19 03:11

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.

查看更多
登录 后发表回答