我想根据平均值或限制值设置高亮度列的颜色。我写了这个剧本;但问题是,当我将鼠标移到红色列上时,它会返回蓝色!有人可以告诉我在我的代码上添加什么,以便它保持红色?感谢
<script>
$(function () {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'donuts1',
type: 'column',
zoomType: 'xy'
},
title: {
text: 'Les données d\'expression du transcrit : <?php echo $id; ?>'
},
subtitle: {
text: document.ontouchstart === undefined ?
'Click and drag in the plot area to zoom in' : 'Pinch the chart to zoom in'
},
xAxis: {
categories: ["<?php echo join($tableauLogin, '","') ?>"] ,
labels: {
rotation: -45,
style: {
fontSize: '11px',
fontFamily: 'Verdana, sans-serif'
}
},
},
yAxis: {
title: {
text: 'Log2(Expression)'
},
minorTickInterval: 1,
min: <?php echo $min-1;?>,
max: <?php echo $max+1;?>,
plotLines: [{
color: '#FF0000',
width: 2,
value: <?php echo $mean ;?> ,// Need to set this probably as a var.
dashStyle: 'ShortDash',
label: {
text: '<?php echo $leg ;?> : <?php echo round($mean,2) ;?>',
align: 'right',
verticalAlign: 'top',
y: -100,
x: -10,
style: {
color: '#FF0000'
}}
}]
},
legend: {
layout: 'vertical',
align: 'left',
verticalAlign: 'top',
x: 50,
floating: true,
borderWidth: 1,
backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
shadow: true
},
series: [{
name: '<?php echo $name ?>',
data: [<?php echo join($tableauNote, ',') ?>]
}]
},function(chart){
var max = <?php echo $mean ;?>;
$.each(chart.series[0].data,function(i,data){
if(data.y > max)
data.graphic.attr({
fill:'#FE2E2E'
});
});
});
});
$('#preview').html(chart.getCSV());
</script>
答案 0 :(得分:0)
我终于找到了自己的解决方案
我重申了这一句话:
data.graphic.attr({ fill:'#FE2E2E'
这一个
data.graphic.css({ color:'#FE2E2E'