You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "vishr (via GitHub)" <gi...@apache.org> on 2026/05/04 04:38:47 UTC

[I] [Feature] Allow OHLC value order for candlestick (currently OCLH) [echarts]

vishr opened a new issue, #21602:
URL: https://github.com/apache/echarts/issues/21602

   ### What problem does this feature solve?
   
   ECharts' candlestick series expects values in the order **\`[open, close, low, high]\`** (OCLH). Every other major charting library, financial data API (Alpaca, Polygon, IEX, Yahoo, FRED, Tradier, Binance, IBKR, etc.), and convention in trading/finance uses **OHLC** (or OHLCV with volume).
   
   This means everyone integrating echarts has to:
   
   1. Re-map every bar from \`[open, high, low, close]\` to \`[open, close, low, high]\` before passing it in, and
   2. Re-map again in tooltip / dataset / event handlers when reading values back.
   
   Both are easy to get wrong silently (the chart still renders \"correctly-ish\" because it auto-detects up vs. down from open/close, but high/low end up swapped on edge cases or labeled wrong in tooltips). Search any echarts integration repo and you'll find a comment explaining the order to the next reader.
   
   ### What does the proposed API look like?
   
   Add an opt-in \`valueFormat\` (or \`valueLayout\`) option on \`candlestick\` series:
   
   \`\`\`js
   {
     type: 'candlestick',
     valueFormat: 'ohlc',   // 'ohlc' | 'oclh' (default — backwards compatible)
     data: [[open, high, low, close], ...]
   }
   \`\`\`
   
   Or, if a string option feels too coarse, an explicit indexer:
   
   \`\`\`js
   {
     type: 'candlestick',
     valueIndices: { open: 0, high: 1, low: 2, close: 3 },
     data: [[open, high, low, close], ...]
   }
   \`\`\`
   
   The default stays OCLH so existing charts are unaffected. Internally, the layout step normalizes to whatever shape the renderer wants, and the tooltip / events expose values via named keys (\`data.open\`, \`data.high\`, …) regardless of the user-supplied order.
   
   ### Alternatives considered
   
   - Document the order more loudly in the candlestick docs — helps, but doesn't remove the silent-mistake risk.
   - Use \`encode\` with \`dataset\` — already supported, but only when you're using the dataset API. Plain \`series.data\` arrays still force OCLH.
   
   ### Anything else?
   
   Happy to send a PR if there's interest in landing this. Filing first to check whether maintainers would accept the option before investing the time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] [Feature] Allow OHLC value order for candlestick (currently OCLH) [echarts]

Posted by "plainheart (via GitHub)" <gi...@apache.org>.
plainheart commented on issue #21602:
URL: https://github.com/apache/echarts/issues/21602#issuecomment-4384409256

   Hi @vishr, thanks for raising this.
   
   As @helgasoft mentioned, `OHLC` input order can already be handled via encode (including when using `series.data`, not only `dataset`), so you can map dimensions explicitly without changing the default `OCLH` behavior.
   
   I've also improved the ECharts documentation to make this clearer for users. https://github.com/apache/echarts-doc/commit/1faf0c27efadabe015256be7d086c02ace95bb0a


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] [Feature] Allow OHLC value order for candlestick (currently OCLH) [echarts]

Posted by "plainheart (via GitHub)" <gi...@apache.org>.
plainheart closed issue #21602: [Feature] Allow OHLC value order for candlestick (currently OCLH)
URL: https://github.com/apache/echarts/issues/21602


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] [Feature] Allow OHLC value order for candlestick (currently OCLH) [echarts]

Posted by "helgasoft (via GitHub)" <gi...@apache.org>.
helgasoft commented on issue #21602:
URL: https://github.com/apache/echarts/issues/21602#issuecomment-4372993810

   > * Use `encode` with `dataset` — already supported, but only when you're using the dataset API. Plain `series.data` arrays still force OCLH.
   
   _encode_ works with _series.data_ - [Demo](https://echarts.apache.org/examples/en/editor.html?code=fZCxboMwEIZ3nuI2D3USIAmpqDpULBkideiIGCi-RlbBRsaVQIh379l1lKhS4uXu7P_--85No1t4hZmCNjmws0FUjIOvY7owKBiPIJxPbQSa4p_45vbSAkukeyu1cubUPr6NcshhBjv1mDMrO2QLhxbPqEQ-L27EFDRdPebJOn7m0EnlsoyU9G61bq3sg3pAI5HkpYebvS-wplaixcHK5pvAVN3RsPfidKQCNhsQ-FX_tDbsIy12H3ZqqdH9w2VNUduafEuWxslhlcSrdMe4wyAiF7K_sPfhsK0qBwfgqYgkuDwCOh0LKu5QAKpGC6rmKS8TvuNbnlbB_BHcU7yOk8B0zbP9TZ75vKquvFW0vPwC&enc=deflate)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org