Specify x-axis labels in D3

会有一股神秘感。 提交于 2020-01-06 14:50:36

问题


I have a stackedAreaChart in d3.js

X-axis labels are 9 dates which I have formatted using tickFormat method. However, I want chart to take each date. Currently it takes every 2nd date.

var dates = ["Jun 07","Jun 08","Jun 09","Jun 10","Jun 11","Jun 12","Jun 13"];
                chart.xAxis.ticks(9);
                chart.xAxis
                    .tickFormat(function(d,e,f) {
                        if(d===1||d==7){
                            return ''
                        }
                        return dates[d-1];
                    });

How can I do that?

Thanks!

来源:https://stackoverflow.com/questions/26549761/specify-x-axis-labels-in-d3

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