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

232
Vistas
Change highchart area chart color for each value

Currently, web application contains Highchart spline-chart that's easy enough to convert into area-chart. My question is two-fold:

A. How to update area-chart color with values that are not on y-axis, so in my example 'count' would be on y-axis however color of area chart would be according to 'sentiment'.

B. How can multiple thresholds be set for different ranges of values in 'sentiment' (I'm assuming through if/else statements in Fetch API?)

Many thanks in advance!

Data structure looks like this:

{'count': [14, 25, 23, 10],
 'sentiment': [5, 4, 1, 3],
 'halfhour': ['11-06-2021, 12:00','11-06-2021, 12:30', '11-06-2021, 13:00', '11-06-2021, 13:30']}

JS code:

<script>
    
    $(document).ready(function(){

            lineChartOptions = {
                chart: { renderTo: 'chart-areaid',
                defaultSeriesType: 'spline' // change this to area-chart
                }, 
                title: {
                    text: ''
                },
                xAxis: { type: 'datetime',
                        categories: []

                },
                yAxis: {
                minPadding: 0.2,
                maxPadding: 0.2,
                title: {text: 'Value',
                        margin: 80}
                },
                series: [{
                    name: 'reddit_stream',
                    animation: false,
                    data: []
                }]
            }

        const lineChart = Highcharts.chart('chart-areaid', lineChartOptions)

            setInterval(() => {
                fetch('/reddit_line_data')
                    .then( resp => resp.json())
                    .then(data => { lineChart.update({ xAxis: { categories: data.halfhour}, 
                                                              series: [{ data: data.count}]}, 
                                                              true, false, false)}); }, 1000)
   </script>




 
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