Echart function options is not unsupported #13723

Closed
opened 2026-02-21 19:13:33 -05:00 by yindo · 2 comments
Owner

Originally created by @LeeeeeeM on GitHub (May 8, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

v1.3.1

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Image

{
  "title": {"text": "2025"},
  "xAxis": {
    "type": "category",
    "data": ["1","2","3","4","5"]
  },
  "yAxis": {"type": "value", "name": "人口规模(万人)"},
  "series": [{
    "type": "bar",
    "data": [1,2,3,4,5],
    "itemStyle": {
      "color": function(params) {
        var colorList = ['#5470c6','#91cc75','#fac858','#ee6666','#73c0de'];
        return colorList[params.dataIndex];
      }
    },
    "label": {
      "show": true,
      "position": "top",
      "formatter": "{c}万人"
    }
  }]
}

✔️ Expected Behavior

Image

Actual Behavior

No response

Originally created by @LeeeeeeM on GitHub (May 8, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version v1.3.1 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce ![Image](https://github.com/user-attachments/assets/bc78a20b-976f-4d3c-9701-68d8d856eca6) ```echarts { "title": {"text": "2025"}, "xAxis": { "type": "category", "data": ["1","2","3","4","5"] }, "yAxis": {"type": "value", "name": "人口规模(万人)"}, "series": [{ "type": "bar", "data": [1,2,3,4,5], "itemStyle": { "color": function(params) { var colorList = ['#5470c6','#91cc75','#fac858','#ee6666','#73c0de']; return colorList[params.dataIndex]; } }, "label": { "show": true, "position": "top", "formatter": "{c}万人" } }] } ``` ### ✔️ Expected Behavior ![Image](https://github.com/user-attachments/assets/4a8ef739-68be-4f59-ada5-4caa4a1bf638) ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-21 19:13:33 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (May 8, 2025):

It seems like you're trying to use a custom color function within the ECharts configuration in Dify, but it's not working as expected. Dify might not support custom JavaScript functions directly within the ECharts configuration, especially in a self-hosted environment.

To resolve this, you can try using predefined color values instead of a function. Here's an example of how you can modify your configuration:

{
  "title": {"text": "2025"},
  "xAxis": {
    "type": "category",
    "data": ["1","2","3","4","5"]
  },
  "yAxis": {"type": "value", "name": "人口规模(万人)"},
  "series": [{
    "type": "bar",
    "data": [1,2,3,4,5],
    "itemStyle": {
      "color": ['#5470c6','#91cc75','#fac858','#ee6666','#73c0de']
    },
    "label": {
      "show": true,
      "position": "top",
      "formatter": "{c}万人"
    }
  }]
}

This approach uses an array of colors directly, which should be supported. If you need dynamic coloring based on data, you might need to handle this logic outside of the ECharts configuration and pass the processed data to the chart.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (May 8, 2025): <!-- Answer --> It seems like you're trying to use a custom color function within the ECharts configuration in Dify, but it's not working as expected. Dify might not support custom JavaScript functions directly within the ECharts configuration, especially in a self-hosted environment. To resolve this, you can try using predefined color values instead of a function. Here's an example of how you can modify your configuration: ```echarts { "title": {"text": "2025"}, "xAxis": { "type": "category", "data": ["1","2","3","4","5"] }, "yAxis": {"type": "value", "name": "人口规模(万人)"}, "series": [{ "type": "bar", "data": [1,2,3,4,5], "itemStyle": { "color": ['#5470c6','#91cc75','#fac858','#ee6666','#73c0de'] }, "label": { "show": true, "position": "top", "formatter": "{c}万人" } }] } ``` This approach uses an array of colors directly, which should be supported. If you need dynamic coloring based on data, you might need to handle this logic outside of the ECharts configuration and pass the processed data to the chart. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=other)</sup>
Author
Owner

@LeeeeeeM commented on GitHub (May 8, 2025):

thx.
If it is not allowed, I will merge it in my branch.

It seems like you're trying to use a custom color function within the ECharts configuration in Dify, but it's not working as expected. Dify might not support custom JavaScript functions directly within the ECharts configuration, especially in a self-hosted environment.

To resolve this, you can try using predefined color values instead of a function. Here's an example of how you can modify your configuration:

{
  "title": {"text": "2025"},
  "xAxis": {
    "type": "category",
    "data": ["1","2","3","4","5"]
  },
  "yAxis": {"type": "value", "name": "人口规模(万人)"},
  "series": [{
    "type": "bar",
    "data": [1,2,3,4,5],
    "itemStyle": {
      "color": ['#5470c6','#91cc75','#fac858','#ee6666','#73c0de']
    },
    "label": {
      "show": true,
      "position": "top",
      "formatter": "{c}万人"
    }
  }]
}

This approach uses an array of colors directly, which should be supported. If you need dynamic coloring based on data, you might need to handle this logic outside of the ECharts configuration and pass the processed data to the chart.

To continue talking to Dosu, mention @dosu.

Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@LeeeeeeM commented on GitHub (May 8, 2025): thx. If it is not allowed, I will merge it in my branch. > It seems like you're trying to use a custom color function within the ECharts configuration in Dify, but it's not working as expected. Dify might not support custom JavaScript functions directly within the ECharts configuration, especially in a self-hosted environment. > > To resolve this, you can try using predefined color values instead of a function. Here's an example of how you can modify your configuration: > > ``` > { > "title": {"text": "2025"}, > "xAxis": { > "type": "category", > "data": ["1","2","3","4","5"] > }, > "yAxis": {"type": "value", "name": "人口规模(万人)"}, > "series": [{ > "type": "bar", > "data": [1,2,3,4,5], > "itemStyle": { > "color": ['#5470c6','#91cc75','#fac858','#ee6666','#73c0de'] > }, > "label": { > "show": true, > "position": "top", > "formatter": "{c}万人" > } > }] > } > ``` > > This approach uses an array of colors directly, which should be supported. If you need dynamic coloring based on data, you might need to handle this logic outside of the ECharts configuration and pass the processed data to the chart. > > _To continue talking to [Dosu](https://dosu.dev), mention [@dosu](https://github.com/dosu)._ > > Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/4d915345-30c5-4a1b-ab2e-a6b5c04bae8b?feedback_type=other)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13723