-
Notifications
You must be signed in to change notification settings - Fork 9
Feat/chart callbacks #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
4f1137d
ca35f96
41b680f
2f74c7c
a0d35a0
169a859
24ff7de
02549da
0e77db5
4a98d98
b819eea
7629314
e34face
6f4c6bb
5421b50
cb62649
1b10de3
9b9db1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| buildscript { | ||
| ext.kotlin_version = '1.8.10' | ||
| ext.kotlin_version = '2.1.0' | ||
| repositories { | ||
| google() | ||
| mavenCentral() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| import 'dart:developer'; | ||
|
|
||
| import 'package:flutter/material.dart'; | ||
| import 'package:graphify/graphify.dart'; | ||
|
|
||
| class ChartClick extends StatefulWidget { | ||
| const ChartClick({super.key}); | ||
|
|
||
| @override | ||
| State<ChartClick> createState() => _ChartClickState(); | ||
| } | ||
|
|
||
| class _ChartClickState extends State<ChartClick> { | ||
| late final GraphifyController _controller; | ||
| String _status = 'Ready to test clicks'; | ||
|
|
||
| @override | ||
| void initState() { | ||
| super.initState(); | ||
| _controller = GraphifyController(); | ||
| _controller.chartClickedEvent.listen((data) { | ||
| debugPrint('listener received: $data'); | ||
| setState(() { | ||
| _status = 'Click received: ${data['name'] ?? 'Unknown'}'; | ||
| }); | ||
|
|
||
| log('TEST: Chart click received: $data'); | ||
| }); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Column( | ||
| children: [ | ||
| Expanded( | ||
| child: Padding( | ||
| padding: const EdgeInsets.all(16), | ||
| child: Text( | ||
| _status, | ||
| style: const TextStyle(fontWeight: FontWeight.bold), | ||
| textAlign: TextAlign.center, | ||
| ), | ||
| ), | ||
| ), | ||
| Container( | ||
| height: 400, | ||
| margin: const EdgeInsets.all(8), | ||
| decoration: BoxDecoration( | ||
| border: Border.all(color: Colors.grey), | ||
| borderRadius: BorderRadius.circular(8), | ||
| ), | ||
| child: GraphifyView( | ||
| controller: _controller, | ||
| onConsoleMessage: (msg) { | ||
| debugPrint('WebView console: ${(msg as dynamic).message}'); | ||
|
Comment on lines
+54
to
+55
|
||
| }, | ||
| initialOptions: const { | ||
| "tooltip": { | ||
| "trigger": "axis", | ||
| "axisPointer": {"type": "shadow"} | ||
| }, | ||
| "legend": { | ||
| "data": ["Sales", "Marketing"] | ||
| }, | ||
| "xAxis": { | ||
| "type": "category", | ||
| "data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] | ||
| }, | ||
| "yAxis": {"type": "value"}, | ||
| "series": [ | ||
| { | ||
| "name": "Sales", | ||
| "type": "bar", | ||
| "data": [120, 200, 150, 80, 70, 110, 130], | ||
| "itemStyle": {"color": "#5470c6"} | ||
| }, | ||
| { | ||
| "name": "Marketing", | ||
| "type": "bar", | ||
| "data": [60, 100, 75, 40, 35, 55, 65], | ||
| "itemStyle": {"color": "#91cc75"} | ||
| } | ||
| ] | ||
| }, | ||
| ), | ||
| ), | ||
| ], | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| void dispose() { | ||
| _controller.dispose(); | ||
| super.dispose(); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,15 +1,17 @@ | ||||||||
| import 'package:graphify/src/controller/interface.dart' as controller_interface; | ||||||||
|
|
||||||||
| class GraphifyController extends controller_interface.GraphifyController { | ||||||||
|
|
||||||||
| @override | ||||||||
| void update(Map<String, dynamic>? options) { | ||||||||
| throw UnimplementedError("update() is not implemented"); | ||||||||
| } | ||||||||
|
|
||||||||
| @override | ||||||||
| Stream<Map<String, dynamic>> get chartClickedEvent => | ||||||||
| throw UnimplementedError("chartClickedEvent is not implemented"); | ||||||||
|
Comment on lines
+10
to
+11
|
||||||||
| Stream<Map<String, dynamic>> get chartClickedEvent => | |
| throw UnimplementedError("chartClickedEvent is not implemented"); | |
| Stream<Map<String, dynamic>> get chartClickedEvent => Stream.empty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version in CHANGELOG.md is documented as 1.2.0, but pubspec.yaml shows 1.2.1. These versions should be consistent across all documentation.