diff --git a/.pubignore b/.pubignore index 880f90e..0f05e77 100644 --- a/.pubignore +++ b/.pubignore @@ -1,5 +1,7 @@ # Pub +DEVLOG.md devdoc/ +example/ # Miscellaneous *.class diff --git a/CHANGELOG.md b/CHANGELOG.md index 13a93c7..4f75d51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 1.0.0 + +**2022-11-01** + +- Graphic has finished initial development and ready for production from this version. The API will be stable while a new major version begins in the design. +- Add size to tooltip renderer function: https://github.com/entronad/graphic/pull/159 + ## 0.10.7 **2022-09-20** diff --git a/DEVLOG.md b/DEVLOG.md index 8c6ff6e..8b8daf9 100644 --- a/DEVLOG.md +++ b/DEVLOG.md @@ -4147,15 +4147,32 @@ animation -信 -介绍: -声明式 +感觉针对数组的可定制回调函数参数还是应该带上index,这个需求挺实际的,不要信了dart的鬼 -可交互 +原则:减少概念,增加flexibility,无论从理论到实践,都应该把flexibility、extensive作为首要目标 -问题 +思考declaration和transformation的关系,D3认为专注transformation有助于提升性能。D3在底层的transformation上还有declarative的helper -1. 对nest的理解,group by -2. elevation作为一个 aes attr \ No newline at end of file +d3这种称为 embedded domain-specifific language + +从实践的角度讲,ticks很重要,特别是在缩放情况下 + + + +是不是可以把 shape提取出来,和geom合并? + + + +似乎 selection updater 也应该改为和signal updater类似的多参数的 + + + +## 论文 + +与gg的区别:shape + +interaction 和 animation + +flutter的图形系统是成立的基础(见d3论文) \ No newline at end of file diff --git a/README.md b/README.md index 7989c1f..ee17cab 100644 --- a/README.md +++ b/README.md @@ -29,16 +29,12 @@ Example of charts can be seen in the [Example App](https://github.com/entronad/g ![examples](https://github.com/entronad/graphic/raw/main/devdoc/examples.jpg) -## Used by - -Graphic is used by these companies: - -[![rows](https://github.com/entronad/graphic/raw/main/devdoc/logo_rows.svg)](https://rows.com/) - ## Tutorials [The Versatility of the Grammar of Graphics](https://medium.com/@entronad/the-versatility-of-the-grammar-of-graphics-d1366760424d) +[How to Build Interactive Charts in Flutter](https://medium.com/@entronad/how-to-build-interactive-charts-in-flutter-e317492d5ba1) + ## Reference Besides *The Grammar of Graphics*, the API terminology also referes to [AntV](https://antv.vision/en) and [Vega](https://vega.github.io/). The dataflow structure is inspired by [Vega](https://vega.github.io/). diff --git a/example/lib/pages/line_area_point.dart b/example/lib/pages/line_area_point.dart index a251b54..88bcd97 100644 --- a/example/lib/pages/line_area_point.dart +++ b/example/lib/pages/line_area_point.dart @@ -221,7 +221,7 @@ class LineAreaPointPage extends StatelessWidget { variables: { 'date': Variable( accessor: (Map map) => map['date'] as String, - scale: OrdinalScale(tickCount: 5), + scale: OrdinalScale(tickCount: 5, inflate: true), ), 'points': Variable( accessor: (Map map) => map['points'] as num, @@ -230,6 +230,7 @@ class LineAreaPointPage extends StatelessWidget { accessor: (Map map) => map['name'] as String, ), }, + coord: RectCoord(horizontalRange: [0.01, 0.99]), elements: [ LineElement( position: diff --git a/lib/src/guide/interaction/crosshair.dart b/lib/src/guide/interaction/crosshair.dart index 3175d1f..77268e4 100644 --- a/lib/src/guide/interaction/crosshair.dart +++ b/lib/src/guide/interaction/crosshair.dart @@ -122,6 +122,7 @@ class CrosshairRenderOp extends Render { } return Offset.zero; } + for (var index in selects) { selectedPoint += findPoint(index); } diff --git a/lib/src/guide/interaction/tooltip.dart b/lib/src/guide/interaction/tooltip.dart index d01f2de..d3c66a5 100644 --- a/lib/src/guide/interaction/tooltip.dart +++ b/lib/src/guide/interaction/tooltip.dart @@ -251,6 +251,7 @@ class TooltipRenderOp extends Render { } return Offset.zero; } + for (var index in selects) { selectedPoint += findPoint(index); } diff --git a/lib/src/interaction/selection/selection.dart b/lib/src/interaction/selection/selection.dart index 30cbbc4..a0affdd 100644 --- a/lib/src/interaction/selection/selection.dart +++ b/lib/src/interaction/selection/selection.dart @@ -283,12 +283,11 @@ class SelectorRenderOp extends Render { final selector = selectors?[name]; if (selector is IntervalSelector) { - scene - .figures = renderIntervalSelector( - selector.points.first, - selector.points.last, - selector.color, - ); + scene.figures = renderIntervalSelector( + selector.points.first, + selector.points.last, + selector.color, + ); } else { // The point selector has no mark for now. diff --git a/lib/src/parse/parse.dart b/lib/src/parse/parse.dart index b241268..79898bb 100644 --- a/lib/src/parse/parse.dart +++ b/lib/src/parse/parse.dart @@ -54,7 +54,8 @@ import 'package:graphic/src/variable/transform/sort.dart'; import 'package:graphic/src/variable/variable.dart'; /// The default padding function for rectangle coordinate. -EdgeInsets _defaultRectPadding(Size _) => const EdgeInsets.fromLTRB(40, 5, 10, 20); +EdgeInsets _defaultRectPadding(Size _) => + const EdgeInsets.fromLTRB(40, 5, 10, 20); /// The default padding function for polar coordinate. EdgeInsets _defaultPolarPadding(Size _) => const EdgeInsets.all(10); diff --git a/lib/src/scale/time.dart b/lib/src/scale/time.dart index 97d9b54..4c8aceb 100644 --- a/lib/src/scale/time.dart +++ b/lib/src/scale/time.dart @@ -58,8 +58,9 @@ class TimeScaleConv extends ContinuousScaleConv { } // If all data are the same, the range is 1 second. - final range = - maxTmp == minTmp ? const Duration(seconds: 1) : maxTmp.difference(minTmp); + final range = maxTmp == minTmp + ? const Duration(seconds: 1) + : maxTmp.difference(minTmp); final marginMin = range * (spec.marginMin ?? 0.1); final marginMax = range * (spec.marginMax ?? 0.1); min = min ?? minTmp.subtract(marginMin); diff --git a/pubspec.yaml b/pubspec.yaml index 5484c69..c69acb6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: graphic description: A grammar of data visualization and Flutter charting library. -version: 0.10.7 +version: 1.0.0 homepage: https://github.com/entronad/graphic environment: