Nodes/Clh Tool for ComfyUI/EchartOption_clh
ComfyUI Node

EchartOption_clh

Build a chart config from plain arrays

By clhui·Created 2 years ago·Updated 10 months ago· 9
EchartOption_clh
    • options
    title保险
    xAxis[ "衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
    data1_name销量
    data1_typeline
    data1[1,2,3,4]
    markLine10
    data2[1,2,3,4]
    data2_name比例
    data2_typeline
    markLine20

    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, or pie.
    • title - the chart's heading.
    • markLine1 - draws a reference line at a value (a threshold or average). Leave it 0 if 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.

    CategorysimpleTool_clh

    Inputs (10)

    NameTypeDefaultDescription
    titleSTRING保险
    xAxisSTRING[ "衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
    data1_nameSTRING销量
    data1_typeCOMBOline3 options: line, bar, pie
    data1STRING[1,2,3,4]
    markLine1STRING0
    data2optSTRING[1,2,3,4]
    data2_nameoptSTRING比例
    data2_typeoptCOMBOline3 options: line, bar, pie
    markLine2optSTRING0

    Outputs (1)

    NameTypeDescription
    optionsSTRING