NVD3 - Changing X Label Axis on a Line Graph

前端 未结 1 1157
孤独总比滥情好
孤独总比滥情好 2021-01-13 22:02

I have a simple line graph with data in the format:

[
    {
        label: \"lebel1\",
        x: 0,
        y: 128
    },
    {
        label: \"lebel1\",
          


        
相关标签:
1条回答
  • 2021-01-13 22:34

    Try something like this

    chart.xAxis.tickValues(['Label 1','Label 2','Label 3','Label 4','Label 5','Label 6','Label 7','Label 8']);
    

    or if you want to get it from the dataset, you could try something like this,

    chart.xAxis.tickValues(function(d) {
        // do all you stuff and return an array
        var dataset = ['Build Array from data'];
    
        return dataset;
    };)
    

    Hope it helps

    0 讨论(0)
提交回复
热议问题