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

201
Visualizações
eCharts fill area horizontally

I have a line type eCharts graph and I want to fill the area between the line and the y axis. The default area filling behaviour happens vertically, the chart fills out the space between the line and the x axis.

vertical default area filldesired horizontal area fill

I know I can swap axes in other chart libraries but doesn't look like an option here in eCharts.

These are the options I'm using to set up the chart:

const options = {
            tooltip: {
                show: false
            },
            grid: {
                show: true,
                top: 0,
                bottom: 40,
                left: 50,
                right: 10,
            },
            xAxis: {
                id: 'x',
                type: 'value',
                min: 0,
                max: 4,
            },
            yAxis: {
                id: 'y',
                type: 'value',
                inverse: true,
                min: range?.min,
                max: range?.max,
                axisLine: {
                    show: true
                },
                splitLine: {
                    show: true
                },
                axisTick: {
                    show: true
                }
            },
            series: {
                type: 'line',
                xAxisId: 'x',
                yAxisId: 'y',
                symbol: 'none',
                smooth: true,
                connectNulls: false,
                // 2d array like [[1,1000], [3, 1250], ...]
                data: filteredData.data,
                lineStyle: {
                    color: '#f00',
                },
                areaStyle: {
                    color: '#f00',
                    origin: 'auto'
                }
            }
        };

Thanks.

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

0

Ok, looks like treating the y axis type as a category instead of value and removing the y axis boundaries did the trick.

yAxis: {
         id: 'y',
         type: 'category', // category and not value
         // y axis boundaries removed
         ...

Outcome after these changes:

enter image description here

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