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

282
Visualizações
Cannot read property 'indexOf' of undefined in highcharts colorAxis

I want to create a scatter chart, where the color of the scatter is determined by a value, which will be displayed on a colorAxis as a gradient. Here is the jsfiddle of the problem:https://jsfiddle.net/codelock/2b3fmnLw/13/ As I have created the component in react, I am importing highcharts, highchartsReact, and heatmap module in the component and wrapping the Highcharts with heatmap like follows:

import HighchartsReact from 'highcharts-react-official'
import { Grid, Typography } from '@material-ui/core'
import hm from 'highcharts/modules/heatmap'

hm(Highcharts)

I am adding options in the colorAxis as follows and then assigning the colorAxis variable in the colorAxis property of the chart.

colorAxis.push({
          id: selected.mixCode,
          min: colorArray?.[0],
          max: colorArray?.[colorArray.length - 1],
          minColor: colorSet[0],
          maxColor: colorSet[3],
          marker: null,
          showInLegend: true,
          marginRight: '10px',
        })

And the chart options stays the same as the referenced fiddle, but values are assigned dynamically. The problem requires the data to be dynamically selected. For example, the current fiddle output shows 2 people - John and Gina. The user has the option to select any 10 names from the given list. There is no error when the first set of people are selected. Everything renders perfectly. After I deselect from the people list for the first time, if I try to select or deselect another person, the app crashes with following error: TypeError: Cannot read property 'indexOf' of undefined. error message

So far I have tried:

  1. replacing heatmap with coloraxis module while importing
  2. If I remove the colorAxis entirely or assign some static value, it works perfectly.
about 4 years ago · Juan Pablo Isaza
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