Highcharts堆积柱形图缺少一些值?

时间:2014-02-04 13:38:39

标签: highcharts

中间列中的图片中的

缺少黄色部分。如果你看标签栏,你可以看到绿色的值为10,黄色的值为12(缺失),红色的值为5。

我已经检查了json和数据库记录,它们看起来很好并且与这些值匹配,但是highcharts只是没有呈现这些部分。

这在整个图表中随机发生。

enter image description here

var chartOptions = dashboards.getChartOptions(data.ChartSize,
                {
                    title: { text: options.title },
                    series: options.series,
                    legend: $.extend({
                        enabled: (data.legend) && data.legend != 'none',
                        align: align,
                        verticalAlign: vAlign,
                        layout: layout,
                        y: 20
                    }, legendOptions),
                    tooltip: {
                        formatter: function () {

                            if (this.series.chart.options.plotOptions.series.stacking && !data.isTimeCharted) {
                                return '<b>' + dashboards.Utils.shorten(this.series.name, 20) + '</b><br/>'
                                    + dashboards.Utils.shorten(this.point.category, 20) + ': ' + this.y;
                            }
                            else if (data.isTimeCharted) {
                                return '<b>' + dashboards.formatDate(this.point.category) + '</b><br/>'
                                        + (data.ChartType === 'line' | data.ChartType === 'column' ? '<b>' + dashboards.Utils.shorten(this.series.name, 20) + '</b><br/>' : '') +
                                         (percentage ? parseFloat(this.percentage).toFixed(2) + '%' : this.y);
                            }
                            else {
                                return '<b>' + dashboards.Utils.shorten(this.point.category, 20) + '</b><br/>'
                                        + (data.ChartType === 'line' ? '<b>' + dashboards.Utils.shorten(this.series.name, 20) + '</b><br/>' : '')+
                                         (percentage ? parseFloat(this.percentage).toFixed(2) + '%' : this.y);
                            }

                        },
                        followPointer: (data.ChartType!=="line"),
                        shared: false
                    },
                    chart: {
                        type: data.ChartType,
                        renderTo: chartContainer[0]
                    },
                    xAxis: {
                        type: (data.isTimeCharted ? "datetime" : "categories"),
                        categories: (data.isTimeCharted ? undefined : currentData.chartData.categories),
                        minTickInterval: (data.isTimeCharted ? 24 * 3600 * 1000 : undefined),
                        labels: (data.isTimeCharted ? { formatter: null } : (data.ChartType === 'column' && (data.topXvalue >=20 || data.topXvalue == 0)) ? { rotation: -85, align: 'right' } : undefined)
                    },
                    yAxis: options.yAxis,
                    plotOptions: {
                        series: {
                            stacking: data.stacking,
                        }
                    },
                    exporting: {
                        enabled: false
                    }
                });

json的剪辑:

{
   "charts":[
      {
         "vitals":[

         ],
         "chartData":[
            {
               "name":"Favourable",
               "data":[
                  {
                     "category":"2013-12-01",
                     "y":"27.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-02",
                     "y":"189.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-03",
                     "y":"143.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-04",
                     "y":"146.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-05",
                     "y":"74.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-06",
                     "y":"142.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-07",
                     "y":"142.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-08",
                     "y":"111.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-09",
                     "y":"226.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-10",
                     "y":"66.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-11",
                     "y":"14.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-12",
                     "y":"28.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-13",
                     "y":"69.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-14",
                     "y":"12.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-15",
                     "y":"10.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-16",
                     "y":"32.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-17",
                     "y":"72.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-18",
                     "y":"35.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-19",
                     "y":"40.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-20",
                     "y":"145.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-21",
                     "y":"24.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-22",
                     "y":"3.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-23",
                     "y":"13.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  },
                  {
                     "category":"2013-12-24",
                     "y":"3.00",
                     "xFilter":"date",
                     "xFilterID":0,
                     "yFilter":null,
                     "yFilterID":0,
                     "seriesFilter":"favourability",
                     "seriesFilterID":1
                  }

1 个答案:

答案 0 :(得分:0)

要检查的一些事项:

  1. 每个系列的数据是否按日期(类别)正确排序?
  2. 检查每个系列是否有每个日期的条目。