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

185
Visualizações
Can we add negative color in highcharts stockchart based on a variable other that data?

Can we add negative color in highcharts based on a variable other that data? Since, the data I have are all positive values but I need to show the chart in red based on a variable which will be negative.

series: [{
            type: 'area',
            data: [-12,24,54,-9,-12],
            visible: false,
            gapSize: 0,
            tooltip: {
                valueDecimals: 2
            },
            marker: {
                enabled: false,
                symbol: 'circle',
                radius: 4,
                lineWidth: 0,
                states: {
                    hover: {
                        fillColor: '#58aa00',
                    }
                },
            },
            lineColor: '#58aa00',
            negativeColor: 'red',
            fillColor: {
                linearGradient: {
                    x1: 0,
                    y1: 0,
                    x2: 0,
                    y2: 1,
                },
                stops: [
                    [0, '#c6e1b2'],
                    [1, Highcharts.color('#eaf4e2')
                        .setOpacity(0)
                        .get("rgba"),
                    ],
                ],
            }

Now from the above code I will get the negative color wherever there is a negative value, but I want to make the chart red based on a different value, say I have a variable x = -20 which is not present in the data array.

Any help would be appreciated. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The negative value is taken from the threshold value, so you can easily define/change it.

Demo: https://jsfiddle.net/BlackLabel/t9zhuakp/

API: https://api.highcharts.com/highcharts/plotOptions.series.threshold

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