HighCharts不在x轴上绘制十进制值

时间:2014-02-21 19:19:42

标签: javascript highcharts

我正在尝试在我的x轴上绘制十进制值,但我的每个数据点都只放在我的主要刻度线上(整数)。我正在使用一组[x,y]配对数据,例如[[35,1500],[35.21,2000],[35.72,3500],[36.32,4000]]

发生了什么,第一项是放在起始值(35)上,第二项(x 35.21)直接放在36上,下一个值(x 35.72)放在37以上,等等。好像我的数据中的x值被忽略了。

以下是图表的设置属性:

chart: {
        zoomType: 'x',
        spacingRight: 10,
        type: 'area'
    },
    title: {
          text: null
    },

    xAxis: {
        allowDecimals: true,
        tickInterval: 1,
        minorTickInterval: 10,

        labels: {
            step: 1
        },
        title: {
            text: null
        }
    },
    yAxis: {
        min: 0,
        title: {
            text: 'total$'
        }
    },
    tooltip: {
        shared: true
    },
    legend: {
        enabled: false
    },
    plotOptions: {
        area: {                
            pointStart: 35,                                
            lineWidth: 1,
            marker: {
                enabled: false
            },
            shadow: false,
            states: {
                hover: {
                    lineWidth: 1
                }
            },
            threshold: null
        }
    },
    series: [
         {
            //index: 1,
            name: 'trajectory$',                                                                       
            data: progressUpdateData,               
         }
     ]                

如何正确绘制x值? 感谢

2 个答案:

答案 0 :(得分:1)

这是一个小提示,显示你在整数之间的分数 http://jsfiddle.net/LLExL/2462/

plotOptions: {
    area: {                
        pointStart: 35,      
        pointPlacement: 'between',                          
        lineWidth: 1,
        marker: {
            enabled: false
        },
        shadow: false,
        states: {
            hover: {
                lineWidth: 1
            }
        },
        threshold: null
    }
}

您可能希望查看http://api.highcharts.com/highcharts#plotOptions.area.pointPlacement,因为您可能将其设置为"on"而不是"between"某处?

答案 1 :(得分:0)

Will的回答对我不起作用。但是,将minmax设置为yAxis。如果您有[[35,1500], [35.21,2000], [35.72,3500], [36.32,4000]]这些值,则只需设置最小值35和最大值37

:此

yAxis: {
    min: 0,
    title: {
        text: 'total$'
    }
},

成为了这个

yAxis: {
    min: 35,
    max: 37,
    title: {
        text: 'total$'
    }
},