如何解决EXTJS 7 areaChart 动态标记或标记自定义
我正在使用 EXTJS 7.3.1 制作面积图,我希望能够根据数据值自定义标记颜色。
我该怎么做。
目前,标记是为整个图表设置的。像这样。enter image description here
当值为
请告诉我
解决方法
您需要为系列创建自定义渲染器函数,see here in the documentation。
像这样:
series: [{
// your series definition,including marker etc.,renderer: function(sprite,config,rendererData,index) {
// renderer function must return the changes
var changes = {};
// get current record in the chart's store
var record = rendererData.store.getData().items[index];
// check value only when it is a marker
if (config.type === 'marker') {
// replace 'fieldName' with your fieldname
// and color1 color2 with the desired colors
changes.fillStyle = record.data.fieldName < 75 ?
'color1' : 'color2';
}
return changes;
}
}],
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。