Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Update to allow CartesianGraph be extended #426

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/charts.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions charts_common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.11.0
* Null support
* Update to latest from internal repo

# 0.10.0
* Internal bug fixes
* Bump versions of intl due to pull request

# 0.9.0
* Internal bug fixes
* Bump versions in Gemlock file due to security alerts
Expand Down
224 changes: 130 additions & 94 deletions charts_common/lib/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ export 'src/chart/bar/bar_renderer.dart'
show BarRenderer, BarRendererElement, ImmutableBarRendererElement;
export 'src/chart/bar/bar_renderer_config.dart'
show
BarRendererConfig,
CornerStrategy,
ConstCornerStrategy,
NoCornerStrategy;
BarRendererConfig,
CornerStrategy,
ConstCornerStrategy,
NoCornerStrategy;
export 'src/chart/bar/bar_renderer_decorator.dart' show BarRendererDecorator;
export 'src/chart/bar/bar_target_line_renderer.dart' show BarTargetLineRenderer;
export 'src/chart/bar/bar_target_line_renderer_config.dart'
Expand All @@ -36,17 +36,54 @@ export 'src/chart/bar/base_bar_renderer_config.dart'
show BarGroupingType, BaseBarRendererConfig;
export 'src/chart/cartesian/axis/axis.dart'
show
domainAxisKey,
measureAxisIdKey,
measureAxisKey,
Axis,
ImmutableAxis,
AxisOrientation,
NumericAxis,
OrdinalAxis,
OrdinalViewport;
export 'src/chart/cartesian/axis/draw_strategy/base_tick_draw_strategy.dart'
show BaseRenderSpec, BaseTickDrawStrategy;
domainAxisKey,
measureAxisIdKey,
measureAxisKey,
Axis,
NumericAxis,
OrdinalAxis,
AxisOrientation,
OrdinalViewport;
export 'src/chart/cartesian/axis/scale.dart'
show
Scale,
Extents,
ScaleOutputExtent,
RangeBandType,
RangeBandConfig,
StepSizeType,
StepSizeConfig,
MutableScale;
export 'src/chart/cartesian/axis/tick_provider.dart'
show
TickProvider,
TickHint,
BaseTickProvider;
export 'src/chart/cartesian/axis/tick_formatter.dart'
show
TickFormatter,
NumericTickFormatter,
OrdinalTickFormatter,
SimpleTickFormatterBase;
export 'src/chart/cartesian/axis/linear/linear_scale.dart'
show
LinearScale;
export 'src/chart/cartesian/axis/tick_formatter.dart'
show
SimpleTickFormatterBase,
OrdinalTickFormatter,
NumericTickFormatter,
TickFormatter;
export 'src/chart/cartesian/axis/tick_provider.dart'
show
BaseTickProvider,
TickProvider;
export 'src/chart/cartesian/axis/static_tick_provider.dart'
show
StaticTickProvider;
export 'src/chart/cartesian/axis/end_points_tick_provider.dart'
show
EndPointsTickProvider;
export 'src/chart/cartesian/axis/draw_strategy/gridline_draw_strategy.dart'
show GridlineRendererSpec;
export 'src/chart/cartesian/axis/draw_strategy/none_draw_strategy.dart'
Expand All @@ -58,54 +95,55 @@ export 'src/chart/cartesian/axis/draw_strategy/small_tick_draw_strategy.dart'
export 'src/chart/cartesian/axis/draw_strategy/tick_draw_strategy.dart'
show TickDrawStrategy;
export 'src/chart/cartesian/axis/numeric_extents.dart' show NumericExtents;
export 'src/chart/cartesian/axis/tick.dart' show Tick;
export 'src/chart/cartesian/axis/draw_strategy/tick_draw_strategy.dart' show TickDrawStrategy;
export 'src/chart/cartesian/axis/spec/axis_spec.dart'
show
AxisSpec,
LineStyleSpec,
RenderSpec,
TextStyleSpec,
TickLabelAnchor,
TickLabelJustification,
TickFormatterSpec,
TickProviderSpec;
AxisSpec,
LineStyleSpec,
RenderSpec,
TextStyleSpec,
TickLabelAnchor,
TickLabelJustification,
TickFormatterSpec,
TickProviderSpec;
export 'src/chart/cartesian/axis/spec/bucketing_axis_spec.dart'
show BucketingAxisSpec, BucketingNumericTickProviderSpec;
export 'src/chart/cartesian/axis/spec/date_time_axis_spec.dart'
show
DateTimeAxisSpec,
DayTickProviderSpec,
AutoDateTimeTickFormatterSpec,
AutoDateTimeTickProviderSpec,
DateTimeEndPointsTickProviderSpec,
DateTimeTickFormatterSpec,
DateTimeTickProviderSpec,
BasicDateTimeTickFormatterSpec,
TimeFormatterSpec,
StaticDateTimeTickProviderSpec;
DateTimeAxisSpec,
DayTickProviderSpec,
AutoDateTimeTickFormatterSpec,
AutoDateTimeTickProviderSpec,
DateTimeEndPointsTickProviderSpec,
DateTimeTickFormatterSpec,
DateTimeTickProviderSpec,
BasicDateTimeTickFormatterSpec,
TimeFormatterSpec,
StaticDateTimeTickProviderSpec;
export 'src/chart/cartesian/axis/spec/end_points_time_axis_spec.dart'
show EndPointsTimeAxisSpec;
export 'src/chart/cartesian/axis/spec/numeric_axis_spec.dart'
show
NumericAxisSpec,
NumericEndPointsTickProviderSpec,
NumericTickProviderSpec,
NumericTickFormatterSpec,
BasicNumericTickFormatterSpec,
BasicNumericTickProviderSpec,
StaticNumericTickProviderSpec;
NumericAxisSpec,
NumericEndPointsTickProviderSpec,
NumericTickProviderSpec,
NumericTickFormatterSpec,
BasicNumericTickFormatterSpec,
BasicNumericTickProviderSpec,
StaticNumericTickProviderSpec;
export 'src/chart/cartesian/axis/spec/ordinal_axis_spec.dart'
show
BasicOrdinalTickProviderSpec,
BasicOrdinalTickFormatterSpec,
FixedPixelOrdinalScaleSpec,
FixedPixelSpaceOrdinalScaleSpec,
OrdinalAxisSpec,
OrdinalTickFormatterSpec,
OrdinalTickProviderSpec,
OrdinalScaleSpec,
RangeOrdinalTickProviderSpec,
SimpleOrdinalScaleSpec,
StaticOrdinalTickProviderSpec;
BasicOrdinalTickProviderSpec,
BasicOrdinalTickFormatterSpec,
FixedPixelOrdinalScaleSpec,
FixedPixelSpaceOrdinalScaleSpec,
OrdinalAxisSpec,
OrdinalTickFormatterSpec,
OrdinalTickProviderSpec,
OrdinalScaleSpec,
SimpleOrdinalScaleSpec,
StaticOrdinalTickProviderSpec;
export 'src/chart/cartesian/axis/spec/percent_axis_spec.dart'
show PercentAxisSpec;
export 'src/chart/cartesian/axis/spec/range_tick_spec.dart' show RangeTickSpec;
Expand Down Expand Up @@ -138,10 +176,10 @@ export 'src/chart/common/behavior/calculation/percent_injector.dart'
show PercentInjector, PercentInjectorTotalType;
export 'src/chart/common/behavior/chart_behavior.dart'
show
BehaviorPosition,
ChartBehavior,
InsideJustification,
OutsideJustification;
BehaviorPosition,
ChartBehavior,
InsideJustification,
OutsideJustification;
export 'src/chart/common/behavior/chart_title/chart_title.dart'
show ChartTitle, ChartTitleDirection;
export 'src/chart/common/behavior/domain_highlighter.dart'
Expand All @@ -160,14 +198,14 @@ export 'src/chart/common/behavior/line_point_highlighter.dart'
show LinePointHighlighter, LinePointHighlighterFollowLineType;
export 'src/chart/common/behavior/range_annotation.dart'
show
AnnotationLabelAnchor,
AnnotationLabelDirection,
AnnotationLabelPosition,
AnnotationSegment,
LineAnnotationSegment,
RangeAnnotation,
RangeAnnotationAxisType,
RangeAnnotationSegment;
AnnotationLabelAnchor,
AnnotationLabelDirection,
AnnotationLabelPosition,
AnnotationSegment,
LineAnnotationSegment,
RangeAnnotation,
RangeAnnotationAxisType,
RangeAnnotationSegment;
export 'src/chart/common/behavior/selection/lock_selection.dart'
show LockSelection;
export 'src/chart/common/behavior/selection/select_nearest.dart'
Expand All @@ -176,11 +214,11 @@ export 'src/chart/common/behavior/selection/selection_trigger.dart'
show SelectionTrigger;
export 'src/chart/common/behavior/slider/slider.dart'
show
Slider,
SliderHandlePosition,
SliderListenerCallback,
SliderListenerDragState,
SliderStyle;
Slider,
SliderHandlePosition,
SliderListenerCallback,
SliderListenerDragState,
SliderStyle;
export 'src/chart/common/behavior/sliding_viewport.dart' show SlidingViewport;
export 'src/chart/common/behavior/sunburst_ring_expander.dart'
show SunburstRingExpander;
Expand All @@ -203,10 +241,10 @@ export 'src/chart/common/processed_series.dart'
show ImmutableSeries, MutableSeries;
export 'src/chart/common/selection_model/selection_model.dart'
show
MutableSelectionModel,
SelectionModel,
SelectionModelType,
SelectionModelListener;
MutableSelectionModel,
SelectionModel,
SelectionModelType,
SelectionModelListener;
export 'src/chart/common/series_datum.dart' show SeriesDatum, SeriesDatumConfig;
export 'src/chart/common/series_renderer.dart'
show rendererIdKey, rendererKey, SeriesRenderer;
Expand All @@ -215,13 +253,13 @@ export 'src/chart/common/series_renderer_config.dart'
export 'src/chart/layout/layout_config.dart' show LayoutConfig, MarginSpec;
export 'src/chart/layout/layout_view.dart'
show
LayoutPosition,
LayoutView,
LayoutViewConfig,
LayoutViewPaintOrder,
LayoutViewPositionOrder,
ViewMargin,
ViewMeasuredSizes;
LayoutPosition,
LayoutView,
LayoutViewConfig,
LayoutViewPaintOrder,
LayoutViewPositionOrder,
ViewMargin,
ViewMeasuredSizes;
export 'src/chart/line/line_chart.dart' show LineChart;
export 'src/chart/line/line_renderer.dart' show LineRenderer;
export 'src/chart/line/line_renderer_config.dart' show LineRendererConfig;
Expand All @@ -234,12 +272,12 @@ export 'src/chart/scatter_plot/comparison_points_decorator.dart'
show ComparisonPointsDecorator;
export 'src/chart/scatter_plot/point_renderer.dart'
show
boundsLineRadiusPxKey,
boundsLineRadiusPxFnKey,
pointSymbolRendererFnKey,
pointSymbolRendererIdKey,
PointRenderer,
PointRendererElement;
boundsLineRadiusPxKey,
boundsLineRadiusPxFnKey,
pointSymbolRendererFnKey,
pointSymbolRendererIdKey,
PointRenderer,
PointRendererElement;
export 'src/chart/scatter_plot/point_renderer_config.dart'
show PointRendererConfig;
export 'src/chart/scatter_plot/point_renderer_decorator.dart'
Expand Down Expand Up @@ -278,15 +316,13 @@ export 'src/common/style/material_style.dart' show MaterialStyle;
export 'src/common/style/style_factory.dart' show StyleFactory;
export 'src/common/symbol_renderer.dart'
show
CircleSymbolRenderer,
CylinderSymbolRenderer,
LineSymbolRenderer,
PointSymbolRenderer,
RectSymbolRenderer,
RectangleRangeSymbolRenderer,
RoundedRectSymbolRenderer,
SymbolRenderer,
TriangleSymbolRenderer;
CircleSymbolRenderer,
CylinderSymbolRenderer,
LineSymbolRenderer,
PointSymbolRenderer,
RectSymbolRenderer,
RoundedRectSymbolRenderer,
SymbolRenderer;
export 'src/common/text_element.dart'
show TextElement, TextDirection, MaxWidthStrategy;
export 'src/common/text_measurement.dart' show TextMeasurement;
Expand Down
11 changes: 11 additions & 0 deletions charts_common/lib/src/chart/line/line_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1600,6 +1600,8 @@ class _Range<D> {
_includePointAsDateTime(value);
} else if (value is String) {
_includePointAsString(value);
} else if (value is Duration) {
_includePointAsDuration(value);
} else {
throw ArgumentError(
'Unsupported object type for LineRenderer domain value: '
Expand Down Expand Up @@ -1627,6 +1629,15 @@ class _Range<D> {
}
}

/// Extends the range to include value by casting as DateTime objects.
void _includePointAsDuration(D value) {
if ((value as Duration).inMilliseconds < (_start as Duration).inMilliseconds) {
_start = value;
} else if ((value as Duration).inMilliseconds > (_end as Duration).inMilliseconds) {
_end = value;
}
}

/// Extends the range to include value by casting as String objects.
///
/// In this case, we assume that the data is ordered in the same order as the
Expand Down
Loading