【问题标题】:EXTJS 7 areaChart Dynamic markers or marker customizationsEXTJS 7 areaChart 动态标记或标记自定义
【发布时间】:2021-07-23 10:27:16
【问题描述】:

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

我该怎么做。

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

我想在值

请告诉我

【问题讨论】:

  • 请提供小提琴样本。

标签: extjs charts colors markers


【解决方案1】:

您需要为系列创建自定义渲染器函数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;
   }
}],

【讨论】:

  • 工作就好。非常感谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-07-09
  • 1970-01-01
  • 2011-04-25
  • 1970-01-01
  • 2020-03-12
  • 2019-05-11
  • 1970-01-01
相关资源
最近更新 更多