Skip to content

Commit

Permalink
v2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
entronad committed Apr 6, 2023
1 parent 019c0d2 commit f9a9490
Show file tree
Hide file tree
Showing 22 changed files with 66 additions and 54 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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**
Expand Down
4 changes: 3 additions & 1 deletion DEVLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,4 +500,6 @@ elements个数不一样的情况太复杂,数据个数不一样时tag也往往

tagEncode 先不要搞默认值了,变量情况复杂不要弄巧成拙,只有在手动改变了data顺序对应被打乱了才要

内部工具函数,尽量保留位置参数或必选参数,哪怕填null,减少错误
内部工具函数,尽量保留位置参数或必选参数,哪怕填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再说吧,这里就这样
4 changes: 2 additions & 2 deletions lib/src/chart/chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class ChartState<D> extends State<Chart<D>> with TickerProviderStateMixin {
/// The view that controlls the data visualization.
///
/// For a chart widget, to "rebuild" means to create a new [view].
View<D>? view;
ChartView<D>? view;

/// Size of the chart widget.
///
Expand Down Expand Up @@ -745,7 +745,7 @@ class _ChartLayoutDelegate<D> 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<D>(
state.view = ChartView<D>(
state.widget,
size,
state,
Expand Down
10 changes: 5 additions & 5 deletions lib/src/chart/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import 'chart.dart';
import 'size.dart';

/// The dataflow graph of a chart.
class View<D> extends Dataflow {
View(
class ChartView<D> extends Dataflow {
ChartView(
Chart<D> spec,
Size size,
TickerProvider tickerProvider,
Expand All @@ -38,17 +38,17 @@ class View<D> 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<GestureEvent> 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<ResizeEvent> 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<ChangeDataEvent<D>> changeDataStream;

/// Emits a gesture event.
Expand Down
8 changes: 4 additions & 4 deletions lib/src/common/operators/render.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/coord/coord.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class RegionOp extends Operator<Rect> {
abstract class RegionBackgroundRenderOp extends Render {
RegionBackgroundRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);
}
8 changes: 4 additions & 4 deletions lib/src/coord/polar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ class PolarCoordConvOp extends CoordConvOp<PolarCoordConv> {
class PolarRegionColorRenderOp extends RegionBackgroundRenderOp {
PolarRegionColorRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand All @@ -306,8 +306,8 @@ class PolarRegionColorRenderOp extends RegionBackgroundRenderOp {
class PolarRegionGradientRenderOp extends RegionBackgroundRenderOp {
PolarRegionGradientRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand Down
8 changes: 4 additions & 4 deletions lib/src/coord/rect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ class RectCoordConvOp extends CoordConvOp<RectCoordConv> {
class RectRegionColorRenderOp extends RegionBackgroundRenderOp {
RectRegionColorRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand All @@ -188,8 +188,8 @@ class RectRegionColorRenderOp extends RegionBackgroundRenderOp {
class RectRegionGradientRenderOp extends RegionBackgroundRenderOp {
RectRegionGradientRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/src/graffiti/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<S extends ElementStyle> {
/// Creates an element.
MarkElement({
Expand Down
8 changes: 4 additions & 4 deletions lib/src/graffiti/graffiti.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ class Graffiti {
final void Function() repaint;

/// The scenes to paint.
final _scenes = <Scene>[];
final _scenes = <MarkScene>[];

/// 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,
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/graffiti/scene.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/guide/annotation/annotation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class Annotation {
abstract class AnnotRenderOp extends Render {
AnnotRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);
}
6 changes: 3 additions & 3 deletions lib/src/guide/annotation/element.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -103,8 +103,8 @@ class ElementAnnotCalcAnchorOp extends Operator<Offset> {
class ElementAnnotRenderOp extends AnnotRenderOp {
ElementAnnotRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand Down
6 changes: 3 additions & 3 deletions lib/src/guide/annotation/line.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -56,8 +56,8 @@ class LineAnnotation extends Annotation {
class LineAnnotRenderOp extends AnnotRenderOp {
LineAnnotRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand Down
4 changes: 2 additions & 2 deletions lib/src/guide/annotation/region.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class RegionAnnotation extends Annotation {
class RegionAnnotRenderOp extends AnnotRenderOp {
RegionAnnotRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand Down
6 changes: 3 additions & 3 deletions lib/src/guide/axis/axis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ class TickInfoOp extends Operator<List<TickInfo>> {
class AxisRenderOp extends Render {
AxisRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand Down Expand Up @@ -301,7 +301,7 @@ class AxisRenderOp extends Render {

/// The axis grid render operator.
class GridRenderOp extends Render {
GridRenderOp(Map<String, dynamic> params, Scene scene, View view)
GridRenderOp(Map<String, dynamic> params, MarkScene scene, ChartView view)
: super(params, scene, view);

@override
Expand Down
4 changes: 2 additions & 2 deletions lib/src/guide/interaction/crosshair.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ class CrosshairGuide {
class CrosshairRenderOp extends Render {
CrosshairRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand Down
4 changes: 2 additions & 2 deletions lib/src/guide/interaction/tooltip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ class TooltipGuide {
class TooltipRenderOp extends Render {
TooltipRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand Down
4 changes: 2 additions & 2 deletions lib/src/interaction/selection/selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ class SelectorOp extends Operator<Map<String, Selector>?> {
class SelectorRenderOp extends Render {
SelectorRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand Down
8 changes: 4 additions & 4 deletions lib/src/mark/mark.dart
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ class GroupOp extends Operator<AttributesGroups> {
class MarkPrimitiveRenderOp extends Render {
MarkPrimitiveRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand Down Expand Up @@ -296,8 +296,8 @@ class MarkPrimitiveRenderOp extends Render {
class MarkLabelRenderOp extends Render {
MarkLabelRenderOp(
Map<String, dynamic> params,
Scene scene,
View view,
MarkScene scene,
ChartView view,
) : super(params, scene, view);

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/src/parse/parse.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ EdgeInsets _defaultPolarPadding(Size _) => const EdgeInsets.all(10);
/// Parses the specification for a view.
void parse<D>(
Chart<D> spec,
View<D> view,
ChartView<D> view,
Size chartSize,
) {
// Event
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit f9a9490

Please sign in to comment.