2017-11-10 3 views
0

と箱ひげ図:Hicharts.js私は次のようなグラフをシミュレートしようとしています平均線

enter image description here

しかし、これまでのところ、私は次のようになり、グラフのためのコードを発見した: enter image description here

を私は最初のプロットに似別の行を追加するにはどうすればよい

Highcharts.chart('container', { 

chart: { 
    type: 'boxplot' 
}, 

title: { 
    text: 'Highcharts box plot styling' 
}, 

legend: { 
    enabled: false 
}, 

xAxis: { 
    categories: ['1', '2', '3', '4', '5'], 
    title: { 
     text: 'Experiment No.' 
    } 
}, 

yAxis: { 
    title: { 
     text: 'Observations' 
    } 
}, 

plotOptions: { 
    boxplot: { 
     fillColor: '#F0F0E0', 
     lineWidth: 2, 
     medianColor: '#0C5DA5', 
     medianWidth: 3, 
     stemColor: '#A63400', 
     stemDashStyle: 'dot', 
     stemWidth: 1, 
     whiskerColor: '#3D9200', 
     whiskerLength: '20%', 
     whiskerWidth: 3 
    } 
}, 

series: [{ 
    name: 'Observations', 
    data: [ 
     [760, 801, 848, 895, 965], 
     [733, 853, 939, 980, 1080], 
     [714, 762, 817, 870, 918], 
     [724, 802, 806, 871, 950], 
     [834, 836, 864, 882, 910] 
    ] 
}] 

}); 

これは、次のコードから生成されましたこれで? ありがとうございますか?

+1

あなたのイメージのように見えるために、グラフのスタイルをどのように、または追加のラインシリーズを追加する方法を求めていますか? –

答えて

1

にあなたのコードをベースとしている例があると思われる、この1:http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/box-plot/あなたはこのように、ラインをプロットするタイプのラインのシリーズを追加する必要があることに加えて

, { 
    name: 'Here is a line', 
    type: 'line', 
    data: [ // x, y positions where 0 is the first category 
     [0, 1000], 
     [1, 718], 
     [2, 951], 
     [3, 969], 
     [4, 969] 
    ] 
} 

タイプlineに設定された値のいずれかのような[[x,y], [x1, y1], ...]上又はこの[y, y1, ...]ように与えることができる

平均線もPLOあり(YはX = 0にマッピングされている場合、Y1は、x = 1などにマッピング)

plotLines: [{ 
     value: 932, 
     color: 'red', 
     width: 1, 
     label: { 
      text: 'Theoretical mean: 932', 
      align: 'center', 
      style: { 
       color: 'gray' 
      } 
     } 
    }] 

これは単なる定数値の行です。例作業

http://jsfiddle.net/y08gyoy1/

+0

はい、私は後でそれを理解しました。しかし、助けてくれてありがとう。 –

関連する問題