EchartOption_clh
Build a chart config from plain arrays
- options
This is the "I have some numbers and I want a chart" node. It builds an ECharts options object - the JSON config that describes a line, bar, or pie chart - from a couple of plain arrays you type in. It doesn't draw anything itself; it produces the config string that EchartGraph clh turns into an actual picture. Think of it as the front half of a two-node pipeline.
Why would you want charts in ComfyUI at all? It's niche, honestly. But if you're building a workflow that produces numbers worth visualizing - a batch of scores, a sweep of settings, some tallied output - dropping a quick bar chart into the graph beats exporting to a spreadsheet. This is the hand-typed version: you write the categories and the values directly.
How it works
ECharts is a charting library that's driven entirely by one big options object: axes, series, titles, colors, all of it lives in that JSON. This node assembles a minimal version of that object for you. You give it axis labels and one or two data series, pick a chart type per series, and it emits the finished options string. No JSON hand-authoring, no library knowledge required - you fill in fields, it writes the config.
The defaults ship in Chinese (the sample x-axis is a list of clothing items, the series is labeled "sales") because the author's Chinese, but they're just placeholder values - overwrite them with your own labels and it behaves the same.
The inputs and outputs that matter
xAxis(multiline) - your category labels as a JSON array, e.g.["Jan","Feb","Mar"]. These are the ticks along the bottom.data1(multiline) - the first series, a JSON array of numbers like[1,2,3,4], one value per x-axis label.data1_name- what to call that series in the legend.data1_type- the chart style for series one:line,bar, orpie.title- the chart's heading.markLine1- draws a reference line at a value (a threshold or average). Leave it0if you don't want one.
Then there's an optional second series - data2, data2_name, data2_type, markLine2 - so you can overlay, say, a bar series and a line series on the same axes. Two series is the ceiling here; if you need more, you're past what this node was built for.
Output is a single options string. That's the ECharts config. Wire it straight into EchartGraph clh to render it.
Installing it
ComfyUI Manager: search Clh Tool for ComfyUI, install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/clhui/ComfyUi-clh-Tool
then restart ComfyUI. After a manual clone, glance at the startup console - if a dependency is missing it'll say so there, and (unlike a Manager install) you'll need to pip install it yourself.
Common issues
The number-one failure is malformed arrays. xAxis and data1 are JSON, so a missing bracket, a trailing comma, or curly-vs-square-bracket mixups will break the generated config and the chart won't render. Keep them clean: ["a","b","c"] for labels, [1,2,3] for numbers.
The second is a length mismatch - if xAxis has five labels but data1 has three numbers, the chart will look wrong or drop points. Match them one-to-one.
And remember this node alone shows you nothing. If you dropped it in and expected a chart, you're missing the other half: its options output has to feed EchartGraph clh, which is the node that actually draws the thing. If your data already lives in a bigger JSON blob rather than tidy arrays, look at EchartOptionByPath clh instead - same output, but it pulls the values out by path expression rather than making you retype them.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| title | STRING | 保险 | — |
| xAxis | STRING | [ "衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] | — |
| data1_name | STRING | 销量 | — |
| data1_type | COMBO | line | 3 options: line, bar, pie |
| data1 | STRING | [1,2,3,4] | — |
| markLine1 | STRING | 0 | — |
| data2opt | STRING | [1,2,3,4] | — |
| data2_nameopt | STRING | 比例 | — |
| data2_typeopt | COMBO | line | 3 options: line, bar, pie |
| markLine2opt | STRING | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| options | STRING | — |