mdcharts 4.4.0
mdcharts: ^4.4.0 copied to clipboard
march.dev charts library. Provides highly customizable and configurable charts.
MDCharts #
march.dev charts library. Provides highly customizable and configurable charts.
Getting Started #
LineChart #
Data
-
REQUIRED data
data
- set of data withDateTime
keys anddouble
values based on which chart will be drawned.
-
There are 2 general types of the
LineChart
:-
Periodical
grid type (onlymonthly
available for now):Periodical means that if there's not enough data to draw full chart (there's gaps between dates) chart will automatically fulfill lacking data based on
LineChartDataType
.-
For
LineChartDataType.bidirectional
data type lacking data will be set to0
. -
For
LineChartDataType.unidirectional
data type lacking data will calculated from previous values so, that charts will be looking like ascending (e.g. Progress) or descending (e.g. Burndown) chart.
-
-
Undefined
grid type:Undefined means that the chart will be drawned using only provided data.
Note that
LineChartDataType
is omitted with this type of grid.
-
-
Max Value
predefinedMaxValue
- predefined max value for the chart.maxValueRoundingMap
- rounding map for the maxValue that is used by beautification function of Y axis labels.
-
Limits
limit
- if provided, will be painted on the chart as a horizontal indication line.limitText
- custom text to set to the label of the limit line.
Note that if
limitText
is set without providedlimit
, there will be no limit line. -
Tooltip builders
titleBuilder
- builds title of the tooltip based onDateTime
key and/ordouble
value from provided data.subtitleBuilder
- builds subtitle of the tooltip based onDateTime
key and/ordouble
value from provided data.
-
Label builder
xAxisLabelBuilder
- builds X axis label based onDateTime
value from provided data.yAxisLabelBuilder
- builds Y axis label based ondouble
value from provided data,maxValue
specifically.
Settings
xAxisDivisions
- quantity of the X axis divisions, defaults to3
.yAxisDivisions
- quantity of the Y axis divisions, defaults to2
.xAxisLabelQuantity
- quantity of the X axis labels to draw, defaults tonull
.axisDivisionEdges
- axis division edges, defaults toAxisDivisionEdges.none
.showAxisX
- whether to show X axis or not, defaults totrue
.showAxisY
- whether to show Y axis or not, defaults totrue
.lineFilling
- whether to fill chart between the line and the X axis or not, defaults totrue
.lineShadow
- whether to draw shadow beneath the line or not, defaults totrue
.altitudeLine
- whether to draw the altitude line or not, defaults totrue
.limitLabelSnapPosition
- snap position options of limit label, defaults toLimitLabelSnapPosition.axis
.showAxisXLabels
- whether to show labels on the X axis or not, defaults totrue
.showAxisYLabels
- whether to show labels on the Y axis or not, defaults totrue
.
Styles
gridStyle
- styling options for the grid, for more details please refer to the source code of theLineChartGridStyle
.axisStyle
- styling options for the axis, for more details please refer to the source code of theLineChartAxisStyle
.lineStyle
- styling options for the chart line, for more details please refer to the source code of theLineChartLineStyle
.limitStyle
- styling options for the limit, for more details please refer to the source code of theLineChartLimitStyle
.pointStyle
- styling options for the point and tooltip above point, for more details please refer to the source code of theLineChartPointStyle
.
BarChart #
Data
-
REQUIRED data
data
- set of data withDateTime
keys andList<double>
values based on which chart will be drawned.
-
Max Value
predefinedMaxValue
- predefined max value for the chart.maxValueRoundingMap
- rounding map for the maxValue that is used by beautification function of Y axis labels.
-
Selection
initialSelectedPeriod
- initial selected period of the bar chart, defaults tonull
.onSelectedPeriodChanged
- callback that notifies if selected period has changed, defaults tonull
.
-
Tooltip builders
titleBuilder
- builds title of the tooltip based onDateTime
key and/orList<double>
value from provided data.subtitleBuilder
- builds subtitle of the tooltip based onDateTime
key and/orList<double>
value from provided data.
-
Label builder
xAxisLabelBuilder
- builds X axis label based onDateTime
value from provided data.yAxisLabelBuilder
- builds Y axis label based ondouble
value from provided data,maxValue
specifically.
Settings
yAxisDivisions
- quantity of the Y axis divisions, defaults to2
.xAxisLabelQuantity
- quantity of the X axis labels to draw, defaults tonull
.axisDivisionEdges
- axis division edges, defaults toAxisDivisionEdges.none
.showAxisX
- whether to show X axis or not, defaults totrue
.showAxisXLabels
- whether to show labels on the X axis or not, defaults totrue
.showAxisYLabels
- whether to show labels on the Y axis or not, defaults totrue
.yAxisLayout
- layout type of the Y axis labels, defaults toYAxisLayout.overlay
.yAxisLabelSpacing
- spacing between the Y axis labels and chart itself, defaults to0
.barSpacing
- spacing between bars in one item, defaults to0
.itemSpacing
- spacing between group of bars, defaults to12
.interaction
- describes how user will be interacting with chart, defaults toInteractionType.selection
.duration
- the length of time animation should last, defaults to400 milliseconds
.alignment
- alignment of the bars within chart, defaults toBarAlignment.end
.reverse
- whether the scroll view scrolls in the reading direction, defaults tofalse
.fit
- insription type of the bars within target box (painting zone), defaults toBarFit.none
.
Style
gridStyle
- styling options for the grid, for more details please refer to the source code of theBarChartGridStyle
.axisStyle
- styling options for the axis, for more details please refer to the source code of theBarChartAxisStyle
.barStyle
- styling options for the chart line, for more details please refer to the source code of theBarChartBarStyle
.tooltipStyle
- styling options for the tooltip, for more details please refer to the source code of theBarChartTooltipStyle
.
Examples #
To see usage example navigate to the Example section.
Feature requests and Bug reports #
Feel free to post a feature requests or report a bug here.
TODO #
- Add MdDate to all charts (with unit-tests)
- Add ability to accept custom painters (requires ENORMOUS amount of time)