From f9a949044e00fe52acca41302c44493edde532c5 Mon Sep 17 00:00:00 2001 From: entronad Date: Thu, 6 Apr 2023 22:09:45 +0800 Subject: [PATCH] v2.0.2 --- CHANGELOG.md | 10 ++++++++++ DEVLOG.md | 4 +++- lib/src/chart/chart.dart | 4 ++-- lib/src/chart/view.dart | 10 +++++----- lib/src/common/operators/render.dart | 8 ++++---- lib/src/coord/coord.dart | 4 ++-- lib/src/coord/polar.dart | 8 ++++---- lib/src/coord/rect.dart | 8 ++++---- lib/src/graffiti/element/element.dart | 2 +- lib/src/graffiti/graffiti.dart | 8 ++++---- lib/src/graffiti/scene.dart | 4 ++-- lib/src/guide/annotation/annotation.dart | 4 ++-- lib/src/guide/annotation/element.dart | 6 +++--- lib/src/guide/annotation/line.dart | 6 +++--- lib/src/guide/annotation/region.dart | 4 ++-- lib/src/guide/axis/axis.dart | 6 +++--- lib/src/guide/interaction/crosshair.dart | 4 ++-- lib/src/guide/interaction/tooltip.dart | 4 ++-- lib/src/interaction/selection/selection.dart | 4 ++-- lib/src/mark/mark.dart | 8 ++++---- lib/src/parse/parse.dart | 2 +- pubspec.yaml | 2 +- 22 files changed, 66 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a070cbf..d1660fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 2.0.2 + +**2023-04-06** + +- Change name the following names to avoid conflict with dart/flutter built-in libraries (https://github.com/entronad/graphic/issues/193, https://github.com/entronad/graphic/pull/200): + + `View -> ChartView` + + `Scene -> MarkScene` + ## 2.0.1 **2023-04-04** diff --git a/DEVLOG.md b/DEVLOG.md index 3903adf..bd54957 100755 --- a/DEVLOG.md +++ b/DEVLOG.md @@ -500,4 +500,6 @@ elements个数不一样的情况太复杂,数据个数不一样时tag也往往 tagEncode 先不要搞默认值了,变量情况复杂不要弄巧成拙,只有在手动改变了data顺序对应被打乱了才要 -内部工具函数,尽量保留位置参数或必选参数,哪怕填null,减少错误 \ No newline at end of file +内部工具函数,尽量保留位置参数或必选参数,哪怕填null,减少错误 + +dart似乎有这样一个规定:当import一般lib(import “library: ... 或文件)时,类名不能冲突。但一个是基础库(例如ui)一个是一般lib时没关系,以一般lib优先。ui.Gradient 和 painting.Gradient 是这种情况,ui.Scene 和 graphic.Scene 是这种情况。原则:凡是和官方库(ui,flutter,painting)冲突的命名都要避免,因此这里也要避免。主要采用增加前缀的方法。因此 View 改为 ChartView,Scene改为MarkScene。至于引擎里的Mark一词是否准确,现在先不想了,这里如果要变体系要变,后面3.0再说吧,这里就这样 \ No newline at end of file diff --git a/lib/src/chart/chart.dart b/lib/src/chart/chart.dart index 7abe084..f1a1532 100644 --- a/lib/src/chart/chart.dart +++ b/lib/src/chart/chart.dart @@ -186,7 +186,7 @@ class ChartState extends State> with TickerProviderStateMixin { /// The view that controlls the data visualization. /// /// For a chart widget, to "rebuild" means to create a new [view]. - View? view; + ChartView? view; /// Size of the chart widget. /// @@ -745,7 +745,7 @@ class _ChartLayoutDelegate extends SingleChildLayoutDelegate { // to create a new view. A view is and only is created in _ChartLayoutDelegate.getPositionForChild // because it needs the current size. - state.view = View( + state.view = ChartView( state.widget, size, state, diff --git a/lib/src/chart/view.dart b/lib/src/chart/view.dart index 3c54b53..330e53b 100644 --- a/lib/src/chart/view.dart +++ b/lib/src/chart/view.dart @@ -12,8 +12,8 @@ import 'chart.dart'; import 'size.dart'; /// The dataflow graph of a chart. -class View extends Dataflow { - View( +class ChartView extends Dataflow { + ChartView( Chart spec, Size size, TickerProvider tickerProvider, @@ -38,17 +38,17 @@ class View extends Dataflow { /// The gesture event stream. /// - /// This is generated in [parse] and hold by [View] for internal interactions. + /// This is generated in [parse] and hold by [ChartView] for internal interactions. late StreamController gestureStream; /// The resize event stream. /// - /// This is generated in [parse] and hold by [View] for internal interactions. + /// This is generated in [parse] and hold by [ChartView] for internal interactions. late StreamController resizeStream; /// The changeData event stream. /// - /// This is generated in [parse] and hold by [View] for internal interactions. + /// This is generated in [parse] and hold by [ChartView] for internal interactions. late StreamController> changeDataStream; /// Emits a gesture event. diff --git a/lib/src/common/operators/render.dart b/lib/src/common/operators/render.dart index 99fd835..1c264dd 100644 --- a/lib/src/common/operators/render.dart +++ b/lib/src/common/operators/render.dart @@ -3,7 +3,7 @@ import 'package:graphic/src/dataflow/operator.dart'; import 'package:graphic/src/graffiti/element/element.dart'; import 'package:graphic/src/graffiti/scene.dart'; -/// The operator to render [MarkElement]s to a [Scene]. +/// The operator to render [MarkElement]s to a [MarkScene]. /// /// Render operators are sink nodes of the dataflow. It has no value, and the rendering /// is a side effect. The [scene] is set in constructor and unchangable. @@ -15,12 +15,12 @@ abstract class Render extends Operator { ) : super(params); /// The scene to render. - final Scene scene; + final MarkScene scene; /// The view. /// - /// It is imported to mark [View.dirty]. - final View view; + /// It is imported to mark [ChartView.dirty]. + final ChartView view; @override evaluate() { diff --git a/lib/src/coord/coord.dart b/lib/src/coord/coord.dart index 909436d..6cf648f 100644 --- a/lib/src/coord/coord.dart +++ b/lib/src/coord/coord.dart @@ -133,7 +133,7 @@ class RegionOp extends Operator { abstract class RegionBackgroundRenderOp extends Render { RegionBackgroundRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); } diff --git a/lib/src/coord/polar.dart b/lib/src/coord/polar.dart index cbaaee0..de38ebf 100644 --- a/lib/src/coord/polar.dart +++ b/lib/src/coord/polar.dart @@ -282,8 +282,8 @@ class PolarCoordConvOp extends CoordConvOp { class PolarRegionColorRenderOp extends RegionBackgroundRenderOp { PolarRegionColorRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override @@ -306,8 +306,8 @@ class PolarRegionColorRenderOp extends RegionBackgroundRenderOp { class PolarRegionGradientRenderOp extends RegionBackgroundRenderOp { PolarRegionGradientRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override diff --git a/lib/src/coord/rect.dart b/lib/src/coord/rect.dart index c57a5eb..1ad96f9 100644 --- a/lib/src/coord/rect.dart +++ b/lib/src/coord/rect.dart @@ -171,8 +171,8 @@ class RectCoordConvOp extends CoordConvOp { class RectRegionColorRenderOp extends RegionBackgroundRenderOp { RectRegionColorRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override @@ -188,8 +188,8 @@ class RectRegionColorRenderOp extends RegionBackgroundRenderOp { class RectRegionGradientRenderOp extends RegionBackgroundRenderOp { RectRegionGradientRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override diff --git a/lib/src/graffiti/element/element.dart b/lib/src/graffiti/element/element.dart index a96a127..5387289 100644 --- a/lib/src/graffiti/element/element.dart +++ b/lib/src/graffiti/element/element.dart @@ -20,7 +20,7 @@ abstract class ElementStyle { bool operator ==(Object other) => other is ElementStyle; } -/// The basic element to compose graphics on [Scene]s. +/// The basic element to compose graphics on [MarkScene]s. abstract class MarkElement { /// Creates an element. MarkElement({ diff --git a/lib/src/graffiti/graffiti.dart b/lib/src/graffiti/graffiti.dart index c44cb57..9f13518 100644 --- a/lib/src/graffiti/graffiti.dart +++ b/lib/src/graffiti/graffiti.dart @@ -20,15 +20,15 @@ class Graffiti { final void Function() repaint; /// The scenes to paint. - final _scenes = []; + final _scenes = []; /// Creates a scene, add it to graffiti, and returns this scene. - Scene createScene({ + MarkScene createScene({ int layer = 0, int builtinLayer = 0, Transition? transition, }) { - final scene = Scene( + final scene = MarkScene( layer: layer, builtinLayer: builtinLayer, transition: transition, @@ -40,7 +40,7 @@ class Graffiti { /// Sorts [_scenes]. /// - /// The priority of comparing is [Scene.layer] > [Scene.builtinLayer]. + /// The priority of comparing is [MarkScene.layer] > [MarkScene.builtinLayer]. void sort() { for (var i = 0; i < _scenes.length; i++) { _scenes[i].preIndex = i; diff --git a/lib/src/graffiti/scene.dart b/lib/src/graffiti/scene.dart index ca45b1a..008eaf5 100644 --- a/lib/src/graffiti/scene.dart +++ b/lib/src/graffiti/scene.dart @@ -7,11 +7,11 @@ import 'transition.dart'; import 'graffiti.dart'; /// A scene for graffiti to paint graphical elements. -class Scene { +class MarkScene { /// Creates a scnene. /// /// You should use [Graffiti.createScene] to get a scene. - Scene({ + MarkScene({ required this.layer, required this.builtinLayer, this.transition, diff --git a/lib/src/guide/annotation/annotation.dart b/lib/src/guide/annotation/annotation.dart index 1b3288e..5ad2654 100644 --- a/lib/src/guide/annotation/annotation.dart +++ b/lib/src/guide/annotation/annotation.dart @@ -22,7 +22,7 @@ abstract class Annotation { abstract class AnnotRenderOp extends Render { AnnotRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); } diff --git a/lib/src/guide/annotation/element.dart b/lib/src/guide/annotation/element.dart index 2147bb8..dc1295c 100644 --- a/lib/src/guide/annotation/element.dart +++ b/lib/src/guide/annotation/element.dart @@ -1,4 +1,4 @@ -import 'dart:ui' hide Scene; +import 'dart:ui'; import 'package:flutter/painting.dart'; import 'package:graphic/src/graffiti/element/rect.dart'; @@ -103,8 +103,8 @@ class ElementAnnotCalcAnchorOp extends Operator { class ElementAnnotRenderOp extends AnnotRenderOp { ElementAnnotRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override diff --git a/lib/src/guide/annotation/line.dart b/lib/src/guide/annotation/line.dart index 54591c5..7c2498a 100644 --- a/lib/src/guide/annotation/line.dart +++ b/lib/src/guide/annotation/line.dart @@ -1,4 +1,4 @@ -import 'dart:ui' hide Scene; +import 'dart:ui'; import 'package:graphic/src/chart/view.dart'; import 'package:graphic/src/common/dim.dart'; @@ -56,8 +56,8 @@ class LineAnnotation extends Annotation { class LineAnnotRenderOp extends AnnotRenderOp { LineAnnotRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override diff --git a/lib/src/guide/annotation/region.dart b/lib/src/guide/annotation/region.dart index 363ba66..574ff6e 100644 --- a/lib/src/guide/annotation/region.dart +++ b/lib/src/guide/annotation/region.dart @@ -69,8 +69,8 @@ class RegionAnnotation extends Annotation { class RegionAnnotRenderOp extends AnnotRenderOp { RegionAnnotRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override diff --git a/lib/src/guide/axis/axis.dart b/lib/src/guide/axis/axis.dart index 09bfc57..b236a0a 100644 --- a/lib/src/guide/axis/axis.dart +++ b/lib/src/guide/axis/axis.dart @@ -244,8 +244,8 @@ class TickInfoOp extends Operator> { class AxisRenderOp extends Render { AxisRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override @@ -301,7 +301,7 @@ class AxisRenderOp extends Render { /// The axis grid render operator. class GridRenderOp extends Render { - GridRenderOp(Map params, Scene scene, View view) + GridRenderOp(Map params, MarkScene scene, ChartView view) : super(params, scene, view); @override diff --git a/lib/src/guide/interaction/crosshair.dart b/lib/src/guide/interaction/crosshair.dart index 7c8602f..4ebc7ce 100644 --- a/lib/src/guide/interaction/crosshair.dart +++ b/lib/src/guide/interaction/crosshair.dart @@ -78,8 +78,8 @@ class CrosshairGuide { class CrosshairRenderOp extends Render { CrosshairRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override diff --git a/lib/src/guide/interaction/tooltip.dart b/lib/src/guide/interaction/tooltip.dart index b4a3e01..c9200a2 100644 --- a/lib/src/guide/interaction/tooltip.dart +++ b/lib/src/guide/interaction/tooltip.dart @@ -183,8 +183,8 @@ class TooltipGuide { class TooltipRenderOp extends Render { TooltipRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override diff --git a/lib/src/interaction/selection/selection.dart b/lib/src/interaction/selection/selection.dart index 4def23f..812ee46 100644 --- a/lib/src/interaction/selection/selection.dart +++ b/lib/src/interaction/selection/selection.dart @@ -262,8 +262,8 @@ class SelectorOp extends Operator?> { class SelectorRenderOp extends Render { SelectorRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override diff --git a/lib/src/mark/mark.dart b/lib/src/mark/mark.dart index af2afe9..bbea08e 100644 --- a/lib/src/mark/mark.dart +++ b/lib/src/mark/mark.dart @@ -251,8 +251,8 @@ class GroupOp extends Operator { class MarkPrimitiveRenderOp extends Render { MarkPrimitiveRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override @@ -296,8 +296,8 @@ class MarkPrimitiveRenderOp extends Render { class MarkLabelRenderOp extends Render { MarkLabelRenderOp( Map params, - Scene scene, - View view, + MarkScene scene, + ChartView view, ) : super(params, scene, view); @override diff --git a/lib/src/parse/parse.dart b/lib/src/parse/parse.dart index f27203d..0713ee3 100644 --- a/lib/src/parse/parse.dart +++ b/lib/src/parse/parse.dart @@ -63,7 +63,7 @@ EdgeInsets _defaultPolarPadding(Size _) => const EdgeInsets.all(10); /// Parses the specification for a view. void parse( Chart spec, - View view, + ChartView view, Size chartSize, ) { // Event diff --git a/pubspec.yaml b/pubspec.yaml index 46b5c00..50e9bb9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: graphic description: A grammar of data visualization and Flutter charting library. -version: 2.0.1 +version: 2.0.2 homepage: https://github.com/entronad/graphic environment: