highcharts / highcharts/highcharts_flutter

HighchartsChart: HighchartsChart widget does not reflect configuration changes without hot restart

Open
#71 1 comment 0 reactions 0 assignees View on GitHub
enhancement planned undecided
Dominant language
Dart
Stars
12
Forks
3
PR merge metrics
No merged PRs in 30d

Description

### Expected behaviour

When working with the HighchartsChart widget in Flutter, any updates made to its configuration or settings (such as modifying chart data, titles, or options) are not reflected immediately in the UI. The widget only updates after performing a hot restart, which is not the expected behavior for a Flutter widget.
In Flutter, widgets are expected to automatically redraw when their configuration changes within setState() or through reactive rebuilds. However, the HighchartsChart widget seems to cache or fail to re-render properly after configuration updates.

Steps to Reproduce
1. Create a Flutter app using the HighchartsChart widget.
2. Initialize the chart with a basic configuration (e.g., line or bar chart).
3. Change a configuration property dynamically (e.g., update data, chart title, or type) inside setState().
4. Observe that the chart does not update.
5. Perform a hot restart, the chart now reflects the new configuration.

**Expected Behavior
The chart should automatically redraw or re-render when its configuration changes, without requiring a hot restart, similar to standard Flutter widget behavior.**

### Actual behaviour

The HighchartsChart widget only reflects configuration changes after a hot restart, not during normal widget rebuilds.

### Version

1.1.2

### Affected devices/platforms

iOS, Android

### Relevant log output

```shell

```

### Relevant code snippet

```dart
import 'package:flutter/material.dart';
import 'package:highcharts_flutter/highcharts.dart';

class LineChartNew extends StatefulWidget {
const LineChartNew({super.key});

@override
State createState() => _LineChartNewState();
}

class _LineChartNewState extends State {
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
children: [
// Here is a Highcharts widget added to the ListView
HighchartsChart(
HighchartsOptions(
// title: HighchartsTitleOptions(text: 'Hello, Flutter!'),
series: [
HighchartsLineSeries(
name: 'My First Series 1',
data: [
[0, 5],
[0.5, 55.5],
[1, 10]
],
options: HighchartsLineSeriesOptions(
color: '#C60',
),
),
],
plotOptions: HighchartsPlotOptions(
series: HighchartsSeriesOptions(
point: HighchartsSeriesPointOptions(
events: HighchartsSeriesPointEventsOptions(
click: HighchartsCallback((args) => {
debugPrint(
'Point value: ${args.first['x']}, ${args.first['y']}')
}),
),
),
),
),
),
),
],
),
);
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.