Highchart:轴的背景颜色 [英] Highchart: Background color of Axis
本文介绍了Highchart:轴的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在这里看到类似的问题。
我的问题是,我写了我们可以用矩形做背景色。可以获得轴上所有滴答的 x
和 Y
位置。我会需要它,因为我只想在不同日期使用背景颜色。
谢谢
解决方案 div>
您是否尝试在背景和 useHTML
标志中使用 labels.formatter
像这样: http://jsfiddle.net/AeV7h/
xAxis:{
categories:['Foo','Bar','Foobar'],
标签:{
useHTML:true,
formatter:function(){
return'< span class =hc-label>'+ this.value +'< / span>';
}
}
},
和CSS: p>
.hc-label {
background-color:red;
padding:0px 5px;
颜色:黄色;
}
I saw a similar question here.
In reply its written that we can have background color by making a rectangle.
My question is how I can get x
and Y
position of all the ticks on axis. I will need it because I want background color only on alternate dates.
Thanks
解决方案
Did you try to use labels.formatter
with background and useHTML
flag? Something like this: http://jsfiddle.net/AeV7h/
xAxis: {
categories: ['Foo', 'Bar', 'Foobar'],
labels: {
useHTML: true,
formatter: function() {
return '<span class="hc-label">' + this.value + '</span>';
}
}
},
And CSS:
.hc-label {
background-color: red;
padding: 0px 5px;
color: yellow;
}
这篇关于Highchart:轴的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文