apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.54k stars 19.61k forks source link

请问candlestick是不支持加载graphic元素吗? #18305

Closed gaoxianglyx closed 1 year ago

gaoxianglyx commented 1 year ago

What problem does this feature solve?

我的需求是在k线图上实现单个蜡烛的拖拽,用candlestick绘制出来k线后,用graphic属性添加circle元素失败。

graphic: echarts.util.map(data0.values, function (item, dataIndex) {
          return {
            type: 'circle',
            position: myChart.convertToPixel('grid', item),
            shape: {r: 5},
            invisible: false,
            draggable: true,
            ondrag: echarts.util.curry(onPointDragging, dataIndex as number),
            onmousemove: echarts.util.curry(showTooltip, dataIndex as number),
            onmouseout: echarts.util.curry(hideTooltip, dataIndex as number),
            z: 100
          };
        })

尝试不用k线图是可以加载的,如果是k线图不支持graphic,请教有实现k线图拖拽修改数据的方案?

What does the proposed API look like?

k线图拖拽蜡烛修改数据

echarts-bot[bot] commented 1 year ago

@gaoxianglyx It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

TRANSLATED
**TITLE** Does candlestick not support loading graphic elements? **BODY** ### What problem does this feature solve? My need is to implement the drag of a single candle on the candlestick chart, and after drawing the candlestick with the candlestick, adding the circle element with the graphic attribute fails. `graphic: echarts.util.map(data0.values, function (item, dataIndex) { return { type: 'circle', position: myChart.convertToPixel('grid', item), shape: {r: 5}, invisible: false, draggable: true, ondrag: echarts.util.curry(onPointDragging, dataIndex as number), onmousemove: echarts.util.curry(showTooltip, dataIndex as number), onmouseout: echarts.util.curry(hideTooltip, dataIndex as number), z: 100 }; })` Try not to use the candlestick chart can be loaded, if the K-line chart does not support graphic, please do you have a solution to implement the candlestick chart dragging and dropping to modify the data? ### What does the proposed API look like? Candlestick chart dragging candles to modify data
helgasoft commented 1 year ago

cannot reproduce, demo code is incomplete

helgasoft commented 1 year ago

here is how to add a draggable graphic circle on candlestick chart - Demo Code. A "single candle" could be built as graphic group, or just by adding a data item to the chart. Graphics created with convertToPixel are not responsive. image