高图-线或区域不在左点开始 [英] Highchart - line or area not starting at the left point

查看:58
本文介绍了高图-线或区域不在左点开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Highchart绘制图形.它工作正常.我遇到了这个问题:

Hi i am doing the graph using Highchart. it works fine. i got this issue:

我将类别指定为月.而线的起点(线/区域)是月的中心,而不是在月的左侧,因此在十月的月中,线的起点是中心,上个月的终点是中心,而不是以图的末尾.但我的客户希望它以适当的月份开始和结束.我添加了jsfiddle供您参考:

i given the categories as months. while the line start (line/area) it is starting center of the month, not in the left of the month point, so in the October month the line start at the center, as well last month end withing center point, not ending with end of the graph. but my client want it to be start and end with appropriate months. i adding the jsfiddle for your reference:

http://jsfiddle.net/QmwaW/

谢谢

推荐答案

看看用几句话-当您设置xAxis.Categories时,xAxis变为字符串"而不是数字".因此,所有刻度线设置(startOnTick,endOnTick ...)都无法使用.一个好技巧是覆盖xAxis.labels格式化程序:

In few words - when you set xAxis.Categories, xAxis becomes 'string' instead of 'numeric'. So all ticks settings (startOnTick, endOnTick...) don't work with it. Good trick is to override xAxis.labels formatter:

var xCategories = ['1990','1991','1992','1993','1994','1995','1996','1997','1998'];

    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container',
        },
        xAxis: {
            labels: {
                formatter: function() {
                    return xCategories[this.value];
                }
            },

            startOnTick: false,
            endOnTick: false,
            minPadding: 0,
            maxPadding: 0,

            gridLineWidth: 1
        },
        series: [{
            data: [2000,9001,1337,100,1000,4444,8888,1844,6780]
        }]
    });

请参阅示例: http://jsfiddle.net/vnJLG/

这篇关于高图-线或区域不在左点开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆