首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >EXTJS7 areaChart动态标记或标记自定义

EXTJS7 areaChart动态标记或标记自定义
EN

Stack Overflow用户
提问于 2021-07-23 18:27:17
回答 1查看 33关注 0票数 0

我正在使用EXTJS 7.3.1处理面积图,我希望能够根据数据值自定义标记颜色。

我怎么能做到这一点。

目前,标记是为整个图表设置的。像这样。enter image description here

我希望当值小于75时更改标记上的颜色

请让我知道

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-07-25 20:33:33

您需要为该系列创建自定义渲染器函数see here in the documentation

如下所示:

代码语言:javascript
复制
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;
   }
}],
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68497740

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档