- To address issue #36, this version allows flutter_charts labels to use a custom font family.
See the section for
ex34OptionsDefiningUserTextStyleOnLabels
in https://pub.dev/packages/flutter_charts .
Also see https://github.com/mzimmerm/flutter_charts/blob/master/doc/readme_images/ex34OptionsDefiningUserTextStyleOnLabels_lineChart.png
The ChartOptions
that were previously set in LabelCommonOptions AND which are properties of Flutter TextStyle
,
(previously LabelCommonOptions.labelFontSize
and LabelCommonOptions.labelTextColor
) are removed in this version.
In this version, such properties can be set as named parameters defined in the getter LabelCommonOptions.labelTextStyle
.
To set those property values, the client has to create their own extension of LabelCommonOptions
, overriding the getter labelTextStyle
,
and setting such properties.
See the section for ex34OptionsDefiningUserTextStyleOnLabels
in https://pub.dev/packages/flutter_charts
.
Google Fonts family Comforter
was installed in this library to present examples of flutter_charts labels with a custom font family,
and a line such as GoogleFonts.config.allowRuntimeFetching = false;
was added to main.dart
.
This is needed because of an apparent Flutter integration tests bug: for a custom font family such as Google Fonts to be used in integration driver tests, the fonts need to be installed. This is ONLY for the benefit of integration tests. To run the app, none of the 2 changes are needed!
See notes in pubspec.yaml
and in code around Comforter
.
I may consider removing those fonts, but keep them in this version for demonstration.
See example ex34OptionsDefiningUserTextStyleOnLabels
.
- Y axis can start at non-zero, request #31. See
- Details: Implemented issue request #31 #31 . Flutter_charts allows the Y axis to start at the minimum Y data values, rather than always from 0.0.
- Code Notes: See method
DataContainerOptions.startYAxisAtDataMinRequested
and optionChartBehavior.startYAxisAtDataMinAllowed
. - More Details:
- The option
startYAxisAtDataMinRequested
should only betrue
if data values are either all positive or all negative. - When all Y values are negative, Y axis starts at the minimum and tops at the maximum of Y values.
- The option
startYAxisAtDataMinRequested
interacts with data transforms such as logarithmic scale, in the sense that the minimum on Y axis is the minimum transformed value.
- The option
- Added logarithmic scale, request #22
- Details: This release added logarithmic scale display. Any other reversible transform of data are also supported. This goes a bit beyond the issue request #22 in #22, which asks for logarithmic scale, but essentially this version implements #22. See the option
DataContainerOptions.yTransform
, and the exampleex52AnimalsBySeasonLogarithmicScale
in README.
There are API changes in this release. Below may or may not be a full list
-
ChartData
now 'knows' aboutChartOptions
, as data validation needs to know about options. For example,ChartData
now needs to check if data are all positive, if theChartOptions
ask for a logarithmic scale. -
As a consequence of the above change,
ChartOptions
parameter has been removed from theChartTopContainer
constructors (such asBarChartTopContainer
), and moved toChartData
constructors.
- Fixed error when all passed data are 0.0
BarChart
,LineChart
API changes: Removed the container parameter from the constructor of BarChart and LineChart. The container is now passed to the painter. A client example of creating a BarChart:ChartData chartData = RandomChartData(); ChartOptions chartOptions = BarChartOptions(); BarChartTopContainer barChartContainer = BarChartTopContainer( chartData: chartData, chartOptions: chartOptions, // optional xContainerLabelLayoutStrategy: xContainerLabelLayoutStrategy, ); BarChart barChart = BarChart( painter: BarChartPainter( barChartContainer: barChartContainer, ), );
- If the container was passed before, it needs to be removed.
- The container is stored on the BarChartPainter and used from there.
- A similar situation for the LineChart.
ChartOptions
,LineOptions
,BarChartOptions
API changes. The constructors of all the options classes have changed.ChartOptions
were split toIterativeLayoutOptions
,LegendOptions
,XContainerOptions
,YContainerOptions
,DataContainerOptions
, andLabelCommonOptions
. Please check the code inexample/main_run_doc_example.dart
which contains examples of how to create instances of those classes.
- The optional ability to hide labels (on x axis, y axis), hide the legend, and hide the gridline has been added. This feature is controlled by ChartOptions. See the code in
example/main_run_doc_example.dart
. This is an out of context example of how to create the options that ignore all labels, legend, and gridline. Ignoring only one, or any combination will also workor to set individual values to false. Default is true so no need to setChartOptions chartOptions = BarChartOptions.noLabels();
ChartOptions chartOptions = BarChartOptions( chartOptions: const ChartOptions( legendOptions: LegendOptions( isLegendContainerShown: false, ), xContainerOptions: XContainerOptions( isXContainerShown: false, ), yContainerOptions: YContainerOptions( isYContainerShown: false, isYGridlinesShown: false, ), ) );
All tests can be run using
tool/test/run_all_tests.sh
This is part of a process to make everything a container. Getting there.
Support for null safety.
Corrected formatting, and a few formal changes from pub auto-checking.
Compatibility with Dart 2.0
Made changes to remove any analyser messages with Dart 2.
Labels auto layout - added pluggable and automated ability to ensure that labels "fit", and do not overlap
This release added the ability to "iteratively auto layout" labels.
Labels auto layout is a sequence of steps, such as skipping some labels, tilting labels, or decreasing label font, that result in label 'fit' nicely, readably, without overflowing or running into each other.
The ability to auto layout labels is implemented using a pluggable base class LabelLayoutStrategy
, and a concrete implemented extension DefaultIterativeLabelLayoutStrategy
. This default implementation of the iterative auto layout achieves that labels, defines a zero or more sequences of steps,
each performing a specific code to achieve labels fit, such as:
- Skipping every 2nd label
- Tilting all labels
- Decreasing label font size
The term "iterative" in "iteratively auto layout" refers to the fact the LabelLayoutStrategy
repeates the layout steps multiple times, until a good fit is achieved.
The LabelLayoutStrategy
and extensions, including the default DefaultIterativeLabelLayoutStrategy
, are members of containers which implement the AdjustableContent
, or extend the abstract AdjustableContentChartAreaContainer
. The term "adjustable content" here refers to ability to adjust sizes of child components, or even remove child components which would overlap in default conditions (sizes, and mumbers). See usages of _xContainerLabelLayoutStrategy
in the sample app example/main_run_doc_example.dart
for an example how to use custom LabelLayoutStrategy
extensions. In practice, AdjustableContent
is only used for multiple potentially overlaping labels. This knowledge is not necessary for most users who are merely using the default (not built in) iterative auto layout provided by the AdjustableContentChartAreaContainer
.
To learn more about the new auto layout process, see the README.md section "Illustration of the new "iterative auto layout" feature".
This release added the ability to skip the legend, when there is insufficient horizontal space.
void defineOptionsAndData() {
_lineChartOptions = new LineChartOptions();
_barChartOptions = new BarChartOptions();
_chartData = new ChartData();
_chartData.dataRowsLegends = [
"Spring",
"Summer"
];
_chartData.dataRows = [
[1.0, 2.0, 3.0, 4.0],
[4.0, 3.0, 5.0, 6.0]
];
_chartData.xLabels = ["One", "Two", "Three", "Four"];
_chartData.assignDataRowsDefaultColors();
// Note: ChartOptions.useUserProvidedYLabels default is still used (false);
}
Reason: This code - revisit when removing need for double data
if (signMax <= 0) {
from = min;
to = 0.0; // was 0, caused issues in Interval typed as double.
} else {
from = 0.0;// was 0, caused issues in Interval typed as double.
to = max;
}
Fixed README.md error - images failing to show (#8)
Implemented change in #5 - allows to set paint on line chart hotspot circles
Added the following new line chart options in charts/line/options.dart
ui.Paint hotspotInnerPaint = new ui.Paint()
..color = material.Colors.yellow;
ui.Paint hotspotOuterPaint = new ui.Paint()
..color = material.Colors.black;
double lineStrokeWidth = 3.0;
Implemented change in #6 - line chart allows to reverse order of data series (dataRows
) to make the significant series line to be on top
Added the following new chart options in charts/options.dart
bool firstDataRowPaintedFirst = true;
Moved the following to options in charts/options.dart
(from being hardcoded)
painting.TextStyle labelTextStyle = new painting.TextStyle(
color: material.Colors.grey[600],
fontSize: 14.0,);
ui.TextDirection labelTextDirection = ui.TextDirection.ltr;
ui.TextAlign labelTextAlign = ui.TextAlign.center;
double labelTextScaleFactor = 1.0;
New name reflects the usage better.
This version finally fixed issue #2 - flutter charts not actually working as a library package (reason: incorrectly specified dependencies).
- Only changes in documentation. Also publishing using
flutter packages pub publish
instead of previously incorrectpub publish
which resulted in a package that reports error on clients' getting the package usingflutter pub get
. Hopefully this change will fix the issue. Below is the full error this new version is trying to fix:
The following log is from a test app in https://github.com/mzimmerm/flutter_charts_sample_app. It is mostly relevant as a documentation of the issue, client apps can ignore this.
flutter_charts_sample_app> flutter pub get
Running "flutter packages get" in flutter_charts_sample_app...
Package flutter_charts has no versions that match >=0.1.3 <0.2.0 derived from:
- flutter_charts_sample_app depends on version ^0.1.3
---- Log transcript ----
FINE: Pub 1.25.0-dev.11.0
MSG : Resolving dependencies...
SLVR: Solving dependencies:
| - flutter_charts ^0.1.3 from hosted (flutter_charts)
| - flutter any from sdk (flutter) (locked to 0.0.37)
IO : Get versions from https://pub.dartlang.org/api/packages/flutter_charts.
IO : HTTP GET https://pub.dartlang.org/api/packages/flutter_charts
| Accept: application/vnd.pub.v2+json
| X-Pub-OS: linux
| X-Pub-Command: get
| X-Pub-Session-ID: 8D558B08-DBBE-4D24-AB8F-C0EEC36157B2
| X-Pub-Environment: flutter_cli
| X-Pub-Reason: direct
| user-agent: Dart pub 1.25.0-dev.11.0
IO : HTTP response 200 OK for GET https://pub.dartlang.org/api/packages/flutter_charts
| took 0:00:00.332100
| transfer-encoding: chunked
| date: Tue, 28 Nov 2017 05:32:06 GMT
| content-encoding: gzip
| vary: Accept-Encoding
| via: 1.1 google
| content-type: application/json
| x-frame-options: SAMEORIGIN
| x-xss-protection: 1; mode=block
| x-content-type-options: nosniff
| server: nginx
SLVR: * start at root
SLVR: | flutter 0.0.37 from sdk is locked
SLVR: | * select flutter 0.0.37 from sdk
SLVR: | | collection 1.14.3 from hosted is locked
SLVR: | | * select collection 1.14.3 from hosted
SLVR: | | | http 0.11.3+14 from hosted is locked
SLVR: | | | * select http 0.11.3+14 from hosted
SLVR: | | | | async 1.13.3 from hosted is locked
SLVR: | | | | * select async 1.13.3 from hosted
SLVR: | | | | | http_parser 3.1.1 from hosted is locked
SLVR: | | | | | * select http_parser 3.1.1 from hosted
SLVR: | | | | | | charcode 1.1.1 from hosted is locked
SLVR: | | | | | | * select charcode 1.1.1 from hosted
SLVR: | | | | | | | meta 1.1.1 from hosted is locked
SLVR: | | | | | | | * select meta 1.1.1 from hosted
SLVR: | | | | | | | | path 1.4.2 from hosted is locked
SLVR: | | | | | | | | * select path 1.4.2 from hosted
SLVR: | | | | | | | | | sky_engine 0.0.99 from path is locked
SLVR: | | | | | | | | | * select sky_engine 0.0.99 from path
SLVR: | | | | | | | | | | source_span 1.4.0 from hosted is locked
SLVR: | | | | | | | | | | * select source_span 1.4.0 from hosted
SLVR: | | | | | | | | | | | stack_trace 1.8.2 from hosted is locked
SLVR: | | | | | | | | | | | * select stack_trace 1.8.2 from hosted
SLVR: | | | | | | | | | | | | string_scanner 1.0.2 from hosted is locked
SLVR: | | | | | | | | | | | | * select string_scanner 1.0.2 from hosted
SLVR: | | | | | | | | | | | | | typed_data 1.1.4 from hosted is locked
SLVR: | | | | | | | | | | | | | * select typed_data 1.1.4 from hosted
SLVR: | | | | | | | | | | | | | | vector_math 2.0.5 from hosted is locked
SLVR: | | | | | | | | | | | | | | * select vector_math 2.0.5 from hosted
SLVR: | | | | | | | | | | | | | | | inconsistent source "hosted" for flutter:
| | | | | | | | | | | | | | | | flutter_charts 0.1.3 from hosted -> flutter >=0.0.20 <0.1.0 from hosted (flutter)
| | | | | | | | | | | | | | | | flutter_charts_sample_app 0.0.0 (root) -> flutter any from sdk (flutter)
SLVR: | | | | | | | | | | | | | | | version 0.1.2 of flutter_charts doesn't match >=0.1.3 <0.2.0:
| | | | | | | | | | | | | | | | flutter_charts_sample_app 0.0.0 (root) -> flutter_charts ^0.1.3 from hosted (flutter_charts)
SLVR: | | | | | | | | | | | | | | | version 0.1.1 of flutter_charts doesn't match >=0.1.3 <0.2.0:
| | | | | | | | | | | | | | | | flutter_charts_sample_app 0.0.0 (root) -> flutter_charts ^0.1.3 from hosted (flutter_charts)
SLVR: | | | | | | | | | | | | | | | version 0.1.0 of flutter_charts doesn't match >=0.1.3 <0.2.0:
| | | | | | | | | | | | | | | | flutter_charts_sample_app 0.0.0 (root) -> flutter_charts ^0.1.3 from hosted (flutter_charts)
SLVR: BacktrackingSolver took 0:00:00.516136 seconds.
| - Tried 1 solutions
| - Requested 1 version lists
| - Looked up 1 cached version lists
|
FINE: Resolving dependencies finished (0.5s).
ERR : Package flutter_charts has no versions that match >=0.1.3 <0.2.0 derived from:
| - flutter_charts_sample_app depends on version ^0.1.3
FINE: Exception type: NoVersionException
FINE: package:pub/src/entrypoint.dart 195 Entrypoint.acquireDependencies
| package:pub/src/command/get.dart 38 GetCommand.run
| package:args/command_runner.dart 194 CommandRunner.runCommand
| package:pub/src/command_runner.dart 168 PubCommandRunner.runCommand.<fn>
| dart:async new Future.sync
| package:pub/src/utils.dart 102 captureErrors.<fn>
| package:stack_trace Chain.capture
| package:pub/src/utils.dart 117 captureErrors
| package:pub/src/command_runner.dart 168 PubCommandRunner.runCommand
| package:pub/src/command_runner.dart 117 PubCommandRunner.run
| /b/build/slave/dart-sdk-linux-dev/build/sdk/third_party/pkg/pub/bin/pub.dart 8 main
| ===== asynchronous gap ===========================
| dart:async _Completer.completeError
| package:pub/src/entrypoint.dart 243 Entrypoint.acquireDependencies
| ===== asynchronous gap ===========================
| dart:async _asyncThenWrapperHelper
| package:pub/src/entrypoint.dart 192 Entrypoint.acquireDependencies
| package:pub/src/command/get.dart 38 GetCommand.run
| package:args/command_runner.dart 194 CommandRunner.runCommand
| ===== asynchronous gap ===========================
| dart:async new Future.microtask
| package:args/command_runner.dart 142 CommandRunner.runCommand
| package:pub/src/command_runner.dart 168 PubCommandRunner.runCommand.<fn>
| dart:async new Future.sync
| package:pub/src/utils.dart 102 captureErrors.<fn>
| package:stack_trace Chain.capture
| package:pub/src/utils.dart 117 captureErrors
| package:pub/src/command_runner.dart 168 PubCommandRunner.runCommand
---- End log transcript ----
pub get failed (1)
- Only changes in README, to figure out how to include images (turns out all links must be external)
- Initial push. Line chart and (vertical) bar chart support. Various options supported.
This package follows Semantic Version 2.0.0. http://semver.org/
Example: 1.2.3 means MAJOR.MINOR.PATCH
Development: Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable.
API Stable versions: All versions with the same MAJOR, where MAJOR>0 must have the same API.