Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

133
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda