Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

179
Vistas
How to drag drop multiple line on epache echarts?

I try to make multiple line drag/drop on apache echarts using graphic util as below code (original code form apache echarts website).

setTimeout(function () {
    myChart.setOption({
        graphic: echarts.util.map(data_line1, function (item, dataIndex) {
            return {
                type: 'circle',
                position: myChart.convertToPixel('grid', item),
                shape: {
                    cx: 0,
                    cy: 0,
                    r: symbolSize / 2
                },
                invisible: true,
                draggable: true,
                ondrag: echarts.util.curry(onPointDragging, dataIndex),
                z: 100
            };
        }),
        graphic: echarts.util.map(data_line2, function (item, dataIndex) {
            return {
                type: 'circle',
                position: myChart.convertToPixel('grid', item),
                shape: {
                    cx: 0,
                    cy: 0,
                    r: symbolSize / 2
                },
                invisible: true,
                draggable: true,
                ondrag: echarts.util.curry(onPointDraggingLine2, dataIndex),
                z: 100
            };
        })
    });
}, 0);

This is update position function

function updatePosition() {
    myChart.setOption({
        graphic: echarts.util.map(data_line1, function (item, dataIndex) {
            return {
                position: myChart.convertToPixel('grid', item)
            };
        }),
         graphic: echarts.util.map(data_line2, function (item, dataIndex) {
            return {
                position: myChart.convertToPixel('grid', item)
            };
        })
    });
     
}

This is on drag function

function onPointDragging(dataIndex, dx, dy) {
    data_line1[dataIndex] = myChart.convertFromPixel('grid', this.position);

    // Update data
    myChart.setOption({
        series: [{
            id: 'a',
            data: data_line1
        }]
    });
}
function onPointDraggingLine2(dataIndex, dx, dy) {
    data_line2[dataIndex] = myChart.convertFromPixel('grid', this.position);

    // Update data
    myChart.setOption({
        series: [{
            id: 'b',
            data: data_line2
        }]
    });
}

But I can handle only the first line. Any advice or guidance on this would be greatly appreciated, Thanks.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda