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

126
Vistas
How to switch out charts on the same canvas with Apache ECharts?

Basically what I'm trying to do is have 5 options of graphs each displaying a different set of data (over the same span of time).

Image of what I currently have; dropdown menu with the 5 options

Here's what I have right now - it's almost everything I want, except the dropdown menu makes it look very messy in my opinion, so I wanted to see if anyone knew of a way using Apache ECharts' library functions to integrate it nicely? I've been looking through the docs for a few hours but I don't think anything fits.

If it helps, the function I'm using right now alongside the dropdown menu is something like:

function change_day_chart(value) {
    if (value == '0') {
        day_chart.setOption(prices, true);
    }
    if (value == '1') {
        day_chart.setOption(buy_volume, true);
    }
    if (value == '2') {
        day_chart.setOption(sell_volume, true);
    }
    if (value == '3') {
        day_chart.setOption(seven_day_buy, true);
    }
    if (value == '4') {
        day_chart.setOption(seven_day_sell, true);
    }
}

tl;dr is there any built-in way to switch between datasets in Apache ECharts?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I don’t know your data, but this is my code.
the same chart get different parameters,use filter function to deal.
For your reference.

 var respon
$.ajax({
    url: 'api/url',
    type: 'post',
    contentType: 'application/json',
    dataType: 'json',
    success: function (rets) {
        respon = rets;
        $('#Select').trigger('change');
        //get all data
    },
    error: function (xhr, ajaxOptions, thrownError) {
        console.log(xhr.responseText);
    }
});

$('#Select').on('change', function () {
    var Qry = $(this).val(); //Select value
    var res = respon.filter(item => item.Flag == Qry)

    //do something
    var option = {
        //Omit
    };
    Chart.setOption(option,true);
});
about 4 years ago · Juan Pablo Isaza Denunciar
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