thekeenant / fcharts Goto Github PK
View Code? Open in Web Editor NEW:bar_chart: Create beautiful, responsive, animated charts using a simple and intuitive API.
Home Page: https://pub.dartlang.org/packages/fcharts
License: MIT License
:bar_chart: Create beautiful, responsive, animated charts using a simple and intuitive API.
Home Page: https://pub.dartlang.org/packages/fcharts
License: MIT License
Bar chart and line chart overlapped (same widget, multiple chart types).
Currently supports circles. Add square, x, plus, lines, and custom shapes.
Hi
i have example code to show line chart, but X and Y axis values not ordered, how can i make it ordered from 0 to big number in series.
`class SimpleLineChart extends StatelessWidget {
// X value -> Y value
static const myData = [
[2,5],
[1,3],
[10,9],
];
@OverRide
Widget build(BuildContext context) {
return new LineChart(
lines: [
new Line<List, String, String>(
data: myData,
xFn: (datum) => datum[0],
yFn: (datum) => datum[1],
),
],
chartPadding: new EdgeInsets.fromLTRB(30.0, 10.0, 10.0, 30.0),
);
}
}`
Flutter 0.10.1 • channel dev • https://github.com/flutter/flutter.git
Framework • revision 6a3ff018b1 (2 weeks ago) • 2018-10-26 01:30:21 -0400
Compiler message:
file:///dev/pub.dartlang.org/fcharts-0.0.9/lib/src/bar/data.dart:14:7: Error: Inferred type argument '#lib1::ChartDrawable<dynamic, #lib1::ChartTouch>'
violates the corresponding type variable bound of 'ChartData' in the supertype 'ChartData' of class 'BarGraphData'.
Try specifying type arguments explicitly so that they conform to the bounds.
class BarGraphData implements ChartData {
^
file:///dev/flutter/.pub-cache/hosted/pub.dartlang.org/fcharts-0.0.9/lib/src/chart_data.dart:4:26: Context: Bound of this variable is violated.
abstract class ChartData<T extends ChartDrawable<T, ChartTouch>> {
^
Compiler terminated unexpectedly.
Please help!
It would be great to have the ability to control the animation of the data being written to the charts. For example a line graph that would draw temperature in realtime while the use is watching it.
No possibility to add grid to chart
Is there a way to define the color of the tick labels?
Hello, i wrote a code to make a chart with 3 lines but only 2 shows on chart.
CODE
LineChart(
lines: [
Line<List, String, double>(
data: jic,
xFn: (datum) => datum[0],
yFn: (datum) => datum[1],
xAxis: xAxis,
yAxis: ChartAxis(
tickLabelFn: (jic) => jic.toString(),
tickLabelerStyle: TextStyle(color: Colors.orange, fontWeight: FontWeight.bold),
paint: PaintOptions.stroke(color: Colors.orange),
),
marker: MarkerOptions(
paint: PaintOptions.fill(color: Colors.orange),
),
stroke: PaintOptions.stroke(color: Colors.orange),
legend: LegendItem(
paint: PaintOptions.fill(color: Colors.orange),
text: 'Jidecoin',
),
),
Line<List, String, double>(
data: amc,
xFn: (datum) => datum[0],
yFn: (datum) => datum[1],
xAxis: xAxis,
yAxis: ChartAxis(
tickLabelFn: (amc) => amc.toString(),
tickLabelerStyle: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),
paint: PaintOptions.stroke(color: Colors.red),
),
marker: MarkerOptions(
paint: PaintOptions.fill(color: Colors.red),
),
stroke: PaintOptions.stroke(color: Colors.red),
legend: LegendItem(
paint: PaintOptions.fill(color: Colors.red),
text: 'Amolecoin',
),
),
Line<List, String, double>(
data: bec,
xFn: (datum) => datum[0],
yFn: (datum) => datum[1],
xAxis: xAxis,
yAxis: ChartAxis(
tickLabelFn: (bec) => bec.toString(),
tickLabelerStyle: TextStyle(color: Colors.green, fontWeight: FontWeight.bold),
paint: PaintOptions.stroke(color: Colors.green),
),
marker: MarkerOptions(
paint: PaintOptions.fill(color: Colors.green),
),
stroke: PaintOptions.stroke(color: Colors.green),
legend: LegendItem(
paint: PaintOptions.fill(color: Colors.green),
text: 'Bekalucoin',
),
),
],
chartPadding: EdgeInsets.fromLTRB(30.0, 22.0, 00.0, 30.0),
),
The line third line is not showing..
HI,I have imported sparkline chart in my project,and the X-axis is aligning according to the number of data available(if there are 3 data,the spacing between them is equal,but if there are more data x-axis is overlapping).So,is there possibility to make the spacing between the data in x-axis constant and make all other data to be swipable horizontally as in scaffold state??...
I'm attaching the code and image of the one i explained above..
code for above pic is..
////---->below is the code for data.
`const cities = [
const City("May 14", Level.Not, 4,3),
const City("May 15", Level.Kinda, 4,4),
const City("May 16", Level.Quite, 4,3),
const City("May 17", Level.Quite, 4,2),
const City("May 18", Level.Quite, 4,1),
const City("May 19", Level.Quite, 4,3),
const City("May 20", Level.Quite, 4,4),
//const City("Palo Alto", Level.Very, 5),
];`
///--->below is the code for graph
` final xAxis = new ChartAxis();
return new AspectRatio(
aspectRatio: 4 / 3,
child: new LineChart(
chartPadding: new EdgeInsets.fromLTRB(60.0, 20.0, 40.0, 30.0),
lines: [
new Line<City, String, int>(
data: cities,
xFn: (city) => city.name,
yFn: (city) => city.size,
xAxis: xAxis,
yAxis: new ChartAxis(
span: new IntSpan(0, 6),
tickGenerator: IntervalTickGenerator.byN(1),
paint: const PaintOptions.stroke(color: Colors.blue),
tickLabelerStyle: new TextStyle(color: Colors.blue, fontWeight: FontWeight.bold),
),
marker: const MarkerOptions(
paint: const PaintOptions.fill(color: Colors.blue),
shape: MarkerShapes.square,
),
stroke: const PaintOptions.stroke(color: Colors.blue),
legend: new LegendItem(
paint: const PaintOptions.fill(color: Colors.blue),
text: 'Ideal',
),
),
new Line<City, String, int>(
data: cities,
xFn: (city) => city.name,
yFn: (city) => city.size1,
xAxis: xAxis,
yAxis: new ChartAxis(
span: new IntSpan(0, 6),
tickGenerator: IntervalTickGenerator.byN(1),
paint: const PaintOptions.stroke(color: Colors.green),
tickLabelerStyle: new TextStyle(color: Colors.green, fontWeight: FontWeight.bold),
),
marker: const MarkerOptions(
paint: const PaintOptions.fill(color: Colors.green),
shape: MarkerShapes.square,
),
stroke: const PaintOptions.stroke(color: Colors.green),
legend: new LegendItem(
paint: const PaintOptions.fill(color: Colors.green),
text: 'Actual',
),
),
],
),
);`
The chart view allows for adding legends, but a line chart or bar chart does not currently.
The documentation is not enough,please provide some detail documentation on How to use multi lines in in Linechart and please specify what each property is about
hi, how i do to load a json file like:
{"data":[{"hour":"00:07:02","value":"31.5"},{"hour":"00:06:29","value":"31.5"}....} into the mydata value to automatically load data and generate the chart?
thanks
How can I set a touch event as you presented in https://pub.dev/packages/fcharts?
Callbacks for when user taps a data point.
Minimal support is available right now.
You must manually specify the padding for the chart currently. Ideally this would not be necessary.
Currently only linear axes are supported. Perhaps some typedef which would map to a linear scale so it can be drawn like normal.
i.e. for semi-log:
10,000 -> 1.0
1,000 -> 0.75
100 -> 0.5
10 -> 0.25
0 -> 0
or for linear (the default):
10,000 -> 1.0
1,000 -> 0.1
100 -> 0.01
10 -> 0.001
0 -> 0
Hi, I'm looking for a histogram implementation, but I can't find any example of how to do it with fcharts, and it seems like it is possible, at least with this version https://pub.dev/packages/fcharts/versions/0.0.4 . Right now some histogram related methods are deprecated and I can't figure it out how to use them. Thanks.
Does the chart support stacked horizontal bar(s) similar to google charts?
X is strictly categorical right now, while Y is strictly continuous.
One might want to represent time on the X axis, which is a continuous measurement. Or you might want categories such as colors on the Y axis.
Hi
I create a line chart but I could not let the x axis and y axis sort same time.
if I sort the data for y axis, the graph will show ...
my line chart code...
LineChart(
chartPadding: new EdgeInsets.fromLTRB(50, 35, 50, 35),
lines: [
new Line<FuelListDetailList, String, double>(
data: consumption,
xFn: (list) => list.record_date,
yFn: (list) => list.liters_per_km,
xAxis: xAxis,
yAxis: new ChartAxis(
tickLabelerStyle: new TextStyle(
color: Colors.blue, fontWeight: FontWeight.bold),
paint: const PaintOptions.stroke(color: Colors.blue),
),
marker: const MarkerOptions(
paint: const PaintOptions.fill(color: Colors.blue),
),
stroke: const PaintOptions.stroke(color: Colors.blue),
legend: new LegendItem(
paint: const PaintOptions.fill(color: Colors.blue),
text: ")",
),
),
// price line
new Line<FuelListDetailList, String, double>(
data: price,
xFn: (list) => list.record_date,
yFn: (list) => list.total_price,
xAxis: xAxis,
yAxis: new ChartAxis(
opposite: true,
paint: const PaintOptions.stroke(color: Colors.green),
tickLabelerStyle: new TextStyle(
color: Colors.green, fontWeight: FontWeight.bold),
),
marker: const MarkerOptions(
paint: const PaintOptions.fill(color: Colors.green),
shape: MarkerShapes.square,
),
stroke: const PaintOptions.stroke(color: Colors.green),
legend: new LegendItem(
paint: const PaintOptions.fill(color: Colors.green),
text: 'price',
),
),
],
),
Is it possible to draw value label on point with line chart?
Mark point with value label
BarChart(...)
just like LineChart(...)
Colors must be manually specified for each element currently. It would be nice to have some sort of a theme object which colors refer to when they are not explicitly given a color. Any color could still be overridden, but the theme options object would be what developers would primarily use to customize colors.
Hello, how can I order the Y axis in order to show a kind of timeline chart? I'm trying something like this, but the Y axis is not ordering, it just appears in the order is set, '37.93' should appear at the top:
static const myData = [
["2018-10-23","37.65"],
["2018-10-24","37.63"],
["2018-10-25","37.93"],
["2018-10-26","37.85"],
["2018-10-27","37.85"]
];
...
LineChart(
lines:
[
new Line<List, String, double>(
stroke: PaintOptions.stroke(color: Colors.green,strokeWidth: 3.0),
marker: MarkerOptions(paint: PaintOptions.fill(color: Colors.blue)),
data: myData,
xFn: (datum) => datum[0],
yFn: (datum) => double.parse(datum[1]),
),
],
chartPadding: new EdgeInsets.fromLTRB(60.0, 10.0, 10.0, 30.0),
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.