Giter Site home page Giter Site logo

thekeenant / fcharts Goto Github PK

View Code? Open in Web Editor NEW
326.0 10.0 46.0 326 KB

:bar_chart: Create beautiful, responsive, animated charts using a simple and intuitive API.

Home Page: https://pub.dartlang.org/packages/fcharts

License: MIT License

Java 0.33% Objective-C 0.66% Dart 99.01%
flutter dart charts library animated charting-library animation

fcharts's People

Contributors

0xpablo avatar ralph-bergmann avatar thekeenant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fcharts's Issues

Legends in normal API

The chart view allows for adding legends, but a line chart or bar chart does not currently.

set x and y axis values ordered

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),
);
}
}`

LineChart not showing all lines in chart

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),
                    ),

Result.
Screen Shot 2019-06-04 at 3 55 40 PM

The line third line is not showing..

Interactive charts

Callbacks for when user taps a data point.

Minimal support is available right now.

Did x axis and y axis sort?

Hi
I create a line chart but I could not let the x axis and y axis sort same time.

image

if I sort the data for y axis, the graph will show ...
image

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',
                ),
              ),
            ],
          ),

or can I fixed the y axis value like this...?
image

[Question] Y axis order

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),
            )

Chart rotation

Support for horizontal bar charts or vertical line charts is hacky right now.

Requires some looking into, there are many approaches to accomplish it. The underlying axes shouldn't have to change, just the line chart and bar chart drawables.

image

Is chart can be in scaffold state?(swipable along X-axis)?

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..

Screenshot_1568882862

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',
        ),
      ),
     
    ],
  ),
);`

Support categorical or continuous axes (both x and y)

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.

load json data into mydata

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

Any histogram example?

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.

revision 6a3ff018b1 (2 weeks ago) • 2018-10-26 01:30:21 -0400 breaks fcharts 0.0.9

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!

Color themes/auto colors

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.

Control of chart animation

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.

Add support for log scale or custom scales

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.