0

这可能是一个微不足道的问题,过去几个小时我一直在尝试在 Highcharts 上做错误栏

以下是我的小提琴

$(function() {
  $('#container').highcharts({
    chart: {
      zoomType: 'xy'
    },
    title: {
      text: 'Temperature vs Rainfall'
    },
    xAxis: [{

    }],
    yAxis: [{ // Primary yAxis
      labels: {
        format: '{value} °C',
        style: {
          color: Highcharts.getOptions().colors[1]
        }
      },
      title: {
        text: 'Temperature',
        style: {
          color: Highcharts.getOptions().colors[1]
        }
      }
    }, { // Secondary yAxis
      title: {
        text: 'Rainfall',
        style: {
          color: Highcharts.getOptions().colors[0]
        }
      },
      labels: {
        format: '{value} mm',
        style: {
          color: Highcharts.getOptions().colors[0]
        }
      },
      opposite: true
    }],

    tooltip: {
      shared: true
    },

    series: [{
      "id": "1",
      "name": "Gas",
      "color": "#3366CC",
      "data": [
        [906.75, 0.0000100686],
        [914.5, 0.0000101503],
        [922.25, 0.0000102317],
        [930, 0.000010313],
        [937.75, 0.0000103941],
        [945.5, 0.0000104751],
        [953.25, 0.0000105558],
        [961, 0.0000106364],
        [968.75, 0.0000107168],
        [976.5, 0.000010797],
        [984.25, 0.000010877],
        [992, 0.0000109569],
        [999.75, 0.0000110366],
        [1007.5, 0.0000111161],
        [1015.25, 0.0000111954],
        [1023, 0.0000112745],
        [1030.75, 0.0000113535],
        [1038.5, 0.0000114323],
        [1046.25, 0.0000115108],
        [1054, 0.0000115893],
        [1061.75, 0.0000116675],
        [1069.5, 0.0000117455],
        [1077.25, 0.0000118234],
        [1085, 0.000011901],
        [1092.75, 0.0000119785],
        [1100.5, 0.0000120558],
        [1108.25, 0.000012133],
        [1116, 0.0000122099],
        [1123.75, 0.0000122866],
        [1131.5, 0.0000123632],
        [1139.25, 0.0000124396],
        [1147, 0.0000125157],
        [1154.75, 0.0000125917],
        [1162.5, 0.0000126675],
        [1170.25, 0.0000127432],
        [1178, 0.0000128186],
        [1185.75, 0.0000128938],
        [1193.5, 0.0000129689],
        [1201.25, 0.0000130437],
        [1209, 0.0000131184],
        [1216.75, 0.0000131929],
        [1224.5, 0.0000132672],
        [1232.25, 0.0000133413],
        [1240, 0.0000134152],
        [1247.75, 0.0000134889],
        [1255.5, 0.0000135624],
        [1263.25, 0.0000136357],
        [1271, 0.0000137088],
        [1278.75, 0.0000137818],
        [1286.5, 0.0000138545],
        [1294.25, 0.0000139271],
        [1302, 0.0000139994],
        [1309.75, 0.0000140716],
        [1310, 0.0000140739],
        [690, 0.00000771572],
        [697.5, 0.00000779934],
        [705.25, 0.00000788558],
        [713, 0.00000797166],
        [720.75, 0.00000805757],
        [728.5, 0.00000814331],
        [736.25, 0.00000822889],
        [744, 0.0000083143],
        [751.75, 0.00000839954],
        [759.5, 0.00000848462],
        [767.25, 0.00000856953],
        [775, 0.00000865426],
        [782.75, 0.00000873883],
        [790.5, 0.00000882323],
        [798.25, 0.00000890746],
        [806, 0.00000899152],
        [813.75, 0.00000907541],
        [821.5, 0.00000915913],
        [829.25, 0.00000924268],
        [837, 0.00000932606],
        [844.75, 0.00000940926],
        [852.5, 0.00000949229],
        [860.25, 0.00000957515],
        [868, 0.00000965783],
        [875.75, 0.00000974035],
        [883.5, 0.00000982268],
        [891.25, 0.00000990484],
        [899, 0.00000998683]
      ]
    }, {
      "name": "Gas Uncertainity",
      "color": "#3366CC",
      "data": [
        [0.0000079392, 0.000012198],
        [0.00000804165, 0.00001225895],
        [0.0000081433, 0.000012320100000000001],
        [0.00000824331, 0.000012382689999999998],
        [0.00000834055, 0.00001244765],
        [0.000008434150000000001, 0.00001251605],
        [0.00000852307, 0.00001258853],
        [0.00000860678, 0.00001266602],
        [0.00000868463, 0.00001274897],
        [0.00000875628, 0.00001283772],
        [0.00000882159, 0.000012932409999999999],
        [0.00000888074, 0.00001303306],
        [0.00000893391, 0.00001313929],
        [0.0000089816, 0.0000132506],
        [0.00000902445, 0.00001336635],
        [0.00000906322, 0.00001348578],
        [0.00000909888, 0.00001360812],
        [0.00000913225, 0.00001373235],
        [0.00000916418, 0.00001385742],
        [0.000009195939999999999, 0.00001398266],
        [0.00000922814, 0.00001410686],
        [0.000009261779999999999, 0.00001422922],
        [0.0000092978, 0.000014349],
        [0.000009336759999999999, 0.000014465240000000001],
        [0.00000937955, 0.00001457745],
        [0.000009426630000000001, 0.00001468497],
        [0.00000947856, 0.000014787440000000001],
        [0.00000953547, 0.00001488433],
        [0.00000959761, 0.00001497559],
        [0.00000966503, 0.00001506137],
        [0.00000973737, 0.00001514183],
        [0.000009813969999999999, 0.00001521743],
        [0.00000989415, 0.00001528925],
        [0.000009976540000000001, 0.00001535846],
        [0.0000100595, 0.0000154269],
        [0.00001014056, 0.00001549664],
        [0.00001021695, 0.00001557065],
        [0.000010285320000000001, 0.00001565248],
        [0.00001034137, 0.00001574603],
        [0.000010380729999999999, 0.00001585607],
        [0.00001039843, 0.00001598737],
        [0.000010389550000000001, 0.000016144850000000002],
        [0.00001034949, 0.000016333110000000002],
        [0.00001027427, 0.00001655613],
        [0.00001016072, 0.00001681708],
        [0.00001000665, 0.00001711815],
        [0.0000098107, 0.0000174607],
        [0.00000957223, 0.00001784537],
        [0.00000929121, 0.00001827239],
        [0.00000896759, 0.000018741409999999997],
        [0.00000860191, 0.000019252289999999998],
        [0.0000081943, 0.0000198045],
        [0.00000774527, 0.00002039793],
        [0.00000773007, 0.000020417729999999998],
        [0.000003741599999999999, 0.00001168984],
        [0.000004200829999999999, 0.00001139785],
        [0.00000463468, 0.00001113648],
        [0.000005026089999999999, 0.00001091723],
        [0.000005373990000000001, 0.00001074115],
        [0.00000567765, 0.00001060897],
        [0.000005937139999999999, 0.00001052064],
        [0.000006153729999999999, 0.00001047487],
        [0.000006330319999999999, 0.00001046876],
        [0.00000647147, 0.00001049777],
        [0.00000658298, 0.00001055608],
        [0.0000066713, 0.00001063722],
        [0.000006742800000000001, 0.00001073486],
        [0.000006803219999999999, 0.00001084324],
        [0.0000068574199999999995, 0.0000109575],
        [0.00000690924, 0.000011073799999999999],
        [0.0000069616, 0.00001118922],
        [0.000007016640000000001, 0.00001130162],
        [0.000007075800000000001, 0.00001140956],
        [0.000007140009999999999, 0.000011512109999999998],
        [0.00000720975, 0.000011608770000000001],
        [0.00000728518, 0.0000116994],
        [0.000007366199999999999, 0.0000117841],
        [0.0000074524299999999996, 0.00001186323],
        [0.000007543390000000001, 0.00001193731],
        [0.00000763838, 0.00001200698],
        [0.00000773662, 0.00001207306],
        [0.000007837229999999999, 0.00001213643]
      ],
      "type": "errorbar",
      "tooltip": {
        "pointFormat": "(Uncertainity: {point.low}-{point.high})<br/>"
      },
      "linkedTo": "1"
    }]
  });
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="height: 400px; margin: auto; min-width: 310px; max-width: 600px"></div>

http://jsfiddle.net/Dilip/m69wuyts/

误差线越来越分离,不知道如何链接它们。请帮忙。

提前致谢。

4

1 回答 1

1

您的错误栏数据应采用[x, low, high] 您拥有的形式[low, high]

此外,您应该按 x 值对数据进行排序。

我为您的数据集添加了一些处理 http://jsfiddle.net/m69wuyts/1/

于 2016-02-19T19:06:36.773 回答