Skip to content

Fix chart reactivity in documentation#1060

Open
IhGori wants to merge 3 commits intomainfrom
fix-chart-reactivity-docs-2291101992291832992
Open

Fix chart reactivity in documentation#1060
IhGori wants to merge 3 commits intomainfrom
fix-chart-reactivity-docs-2291101992291832992

Conversation

@IhGori
Copy link
Contributor

@IhGori IhGori commented Feb 13, 2026

Chart components in the documentation now correctly reflect prop changes made in the interactive playground. This was achieved by adding and improving watchers in all chart components to ensure proper reactivity and re-rendering when props change.

Fixes #1059


PR created automatically by Jules for task 2291101992291832992 started by @IhGori

This commit fixes an issue where chart components (BarChart, LineChart, DonutChart, etc.) in the documentation were not reflecting prop changes made via the playground.

The fix involves:
- Adding missing watchers for several props in each chart component.
- Ensuring watchers trigger data/options updates (e.g., calling mergeChartDataNoSelect).
- Updating chartOptions reactively by replacing the object instead of direct property mutation, ensuring vue-chartjs detects the changes.
- Addressing feedback from code review by adding immediate:true to new watchers in LineChart.vue.

Co-authored-by: IhGori <73910233+IhGori@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@greptile-apps
Copy link

greptile-apps bot commented Feb 13, 2026

Greptile Overview

Greptile Summary

Este PR corrige problemas de reatividade nos componentes de gráfico da documentação, garantindo que mudanças de props no playground interativo sejam refletidas corretamente nos gráficos.

Principais mudanças:

  • Adicionados watchers para props como variant, labels, theme, colors, barWidth, horizontalBar em todos os componentes de gráfico
  • Watchers disparam mergeChartDataNoSelect() para reconstruir os dados do gráfico quando props mudam
  • Melhorias na atualização de chartOptions usando spread operator para garantir reatividade do Vue
  • Correções de formatação (espaços em branco)

Problema encontrado:

  • PolarAreaChart.vue referencia this.showLabelName na linha 212, mas essa prop não está definida no componente, o que causará erro em runtime

Confidence Score: 4/5

  • Este PR é seguro para merge com pequenos ajustes
  • O PR implementa melhorias necessárias de reatividade nos componentes de gráfico, mas contém um bug lógico em PolarAreaChart.vue que referencia uma prop inexistente (showLabelName). As demais alterações são consistentes e seguem o padrão estabelecido.
  • Atenção especial para src/components/PolarAreaChart.vue devido ao uso de prop não definida

Important Files Changed

Filename Overview
src/components/BarChart.vue Adicionados watchers para labels, variant, horizontalBar e barWidth que acionam mergeChartDataNoSelect() para garantir reatividade. Pequenos ajustes de formatação.
src/components/DonutChart.vue Adicionados watchers para theme e colors que disparam mergeChartDataNoSelect(). Watcher variant também atualiza os dados do gráfico.
src/components/LineChart.vue Adicionados múltiplos watchers (theme, showLabelName, fill, borderDash, scales, animation, plugins, xAxisRange, yAxisRange, smoothing) para melhorar reatividade do gráfico.
src/components/PieChart.vue Adicionado watcher para colors e melhorias nos watchers de labels e variant para acionar atualização dos dados do gráfico.
src/components/PolarAreaChart.vue Adicionado watcher para isVisiblePointNames que atualiza chartOptions.scales.r.pointLabels.display para reatividade das labels dos pontos.
src/components/RadialBarChart.vue Adicionados watchers para theme e colors que acionam mergeChartDataNoSelect() para garantir atualização quando essas props mudam.
src/components/StackedBarChart.vue Adicionado watcher para theme e melhorias no watcher barWidth para usar spread operator e garantir reatividade adequada do chartOptions.

Sequence Diagram

sequenceDiagram
    participant User as Usuário (Playground)
    participant Comp as Componente de Gráfico
    participant Watcher as Watchers
    participant Methods as mergeChartDataNoSelect()
    participant Chart as Chart.js

    User->>Comp: Altera prop (variant, labels, etc.)
    Comp->>Watcher: Detecta mudança na prop
    Watcher->>Methods: Aciona mergeChartDataNoSelect()
    Methods->>Methods: Reconstrói localChartData
    Methods->>Chart: Atualiza dados do gráfico
    Chart->>User: Renderiza gráfico atualizado
Loading

Last reviewed commit: b395477

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Feb 13, 2026

Additional Comments (1)

src/components/PolarAreaChart.vue
referência a this.showLabelName que não foi definida como prop neste componente

						label: state.label,

@IhGori IhGori added jules Marca o Google Jules para investigação. and removed jules Marca o Google Jules para investigação. labels Feb 13, 2026
@IhGori
Copy link
Contributor Author

IhGori commented Feb 13, 2026

Problemas encontrados:

No barChart:
- Não consigo gerenciar o estado da prop no switch da prop HorizontalBar
- Alterar a prop BarWidth não reflete em alteração na renderização

@IhGori
Copy link
Contributor Author

IhGori commented Feb 13, 2026

Problemas encontrados:

No lineChart:

  • Está por padrão com dashed e nao linhas continuas

Exemplo como estava:

image

Exemplo como ficou com a alteração:

image

@IhGori
Copy link
Contributor Author

IhGori commented Feb 13, 2026

Problemas encontrados:

No polarChart:

  • O switch da prop showLabelName na documentação não consigo interagir

…round

- Added watchers for all relevant props in BarChart, LineChart, DonutChart, PieChart, PolarAreaChart, RadialBarChart, and StackedBarChart.
- Ensured chartOptions updates are reactive by using object spread to trigger Vue reactivity.
- Fixed RadialBarChart prop type and largest value calculation.
- Improved LineChart dashed line logic to respect isDashed prop.
- Optimized BarChart scale merging to prevent discarding custom configurations.
- Verified changes with unit tests and local documentation server.

Co-authored-by: IhGori <73910233+IhGori@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 Bug Algo não está funcionando jules Marca o Google Jules para investigação.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interação com componentes de gráficos na documentação do Cuida

1 participant