2017-11-01 3 views
0

ハイチャートボックスプロット=>を使用しています。これは各グループ(各ボックス)ごとに異なる色にしたいと考えています。 私はシリーズレベルで色を提供できますが、それはすべてのボックスの色を変更します。 私が達成したいのは、各ボックスごとに異なる色を持つことです。 これを達成する最良の方法をお探しください。ボックスプロット(ハイチャート)の各グループの色を変更するには

Highcharts.chart('container', { 

chart: { 
    type: 'boxplot' 
}, 

title: { 
    text: 'Highcharts Box Plot Example' 
}, 

legend: { 
    enabled: false 
}, 

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

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

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] 
    ], 
    tooltip: { 
     headerFormat: '<em>Experiment No {point.key}</em><br/>' 
    } 
}, { 
    name: 'Outlier', 
    color: Highcharts.getOptions().colors[0], 
    type: 'scatter', 
    data: [ // x, y positions where 0 is the first category 
     [0, 644], 
     [4, 718], 
     [4, 951], 
     [4, 969] 
    ], 
    marker: { 
     fillColor: 'white', 
     lineWidth: 1, 
     lineColor: Highcharts.getOptions().colors[0] 
    }, 
    tooltip: { 
     pointFormat: 'Observation: {point.y}' 
    } 
}] 

}を見てください)。

http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/box-plot/

おかげ

+0

私は各ボックスの新しいシリーズの敵を作成することによって、これを行うことができていますし、その後、各シリーズに異なる色を適用するが、x軸のカテゴリを管理するために、私はいくつかの空の配列を追加する必要があります..私はそれが好きではありません。 http://jsfiddle.net/ccvhrhpr/ –

答えて

0

いくつかの研究の後私は答えを見つけ、

plotOptions: { 
    series: { 
     colorByPoint: true 
    } 
} 

おかげ

関連する問題