flutter_adaptive_charts_fs 0.5.0
flutter_adaptive_charts_fs: ^0.5.0 copied to clipboard
Additional adaptive card components that provide charting capabilities for the Flutter Adaptive Cards ecosystem.
Flutter Adaptive Charts #
A set of adaptive cards that are charts based on the 1.6 spec. Packaged as a separate library to remove the dependency on the charting library from the main adaptive cards library.
Microsoft Adaptive Cards #
This project is in no way associated with Microsoft. It is an open source project to create an adaptive card implementation for Flutter.
Features #
Chart.VerticalBar: Vertical Bar Chartschart.HorizontalBar: Horizontal Bar ChartsChart.Donutz: Donut ChartChart.Pie: Pie ChartChart.Line: Line Charts
Not tested #
Chart.VerticalBar.Grouped: Vertical Grouped Bar ChartsChart.HorizontalBar.Stacked: Horizontal Stacked Bar Charts
Not Implemented #
Chart.Gauge: Gauge Charts - no clear way to implement in fl_chart
Getting started #
Pass in the additional charting elements to Registry on start up
const AdaptiveCard({
super.key,
required this.adaptiveCardContentProvider,
this.placeholder,
this.cardRegistry = const CardTypeRegistry(
addedElements: additionalChartElements,
),
this.actionTypeRegistry = const DefaultActionTypeRegistry(),
this.initData,
this.onChange,
this.listView = false,
this.showDebugJson = true,
this.supportMarkdown = true,
required this.hostConfigs,
});
Color Configuration #
The charts package supports theme-aware color resolution via HostConfig. You can define a default palette and a default color for all charts in your application by updating the chartColors property in your HostConfig.
Example: Injecting a Custom Palette #
final myConfig = HostConfig(
chartColors: ChartColorsConfig(
defaultPalette: [
Colors.indigo,
Colors.cyan,
Colors.teal,
Colors.amber,
],
defaultColor: Colors.blueGrey,
),
);
AdaptiveCardsRoot(
hostConfigs: HostConfigs(light: myConfig),
// ...
);
Example: JSON HostConfig #
{
"chartColors": {
"defaultPalette": ["#3F51B5", "#00BCD4", "#009688", "#FFC107"],
"defaultColor": "#607D8B"
}
}
Individual data items can still override these colors using the "color" property (hex or semantic names like "good", "warning", "attention", "accent").
Usage #
Please refer to the examples in the main repository for creating AdaptiveCards JSON that matches the charts 1.6 spec.
Additional information #
This package is part of the Flutter-AdaptiveCards ecosystem.
For more information, please visit the Main GitHub Repository. There you can find details about how this package integrates with the core library, how to contribute, and how to file issues.