Coder Social home page Coder Social logo

kannel-outis / draw_graph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from malihanan/draw_graph

0.0 0.0 0.0 73 KB

A dart package to draw line graphs in your Flutter app.

License: MIT License

Dart 93.68% Kotlin 3.05% Swift 3.00% Objective-C 0.27%

draw_graph's Introduction

Draw Graph

A dart package to draw line graphs in your flutter app.

Usage

  • Getting graph widget:

    LineGraph Widget

    Properties

    • features: List

      A list of features to be shown in the graph. Detailed description of Feature class below. (required)

    • size: Size

      This will determine the size of your graph. Height will be size.height - 50 in case when description is showed. (required)

    • labelX: List<String>

      A list of X-Axis Labels. This will determine and number of cells to distribute your data in and the width of your cells.

    • labelY: List<String>

      A list of Y-Axis Labels. The labels will be distributed on Y-Axis and determine height on cells.

    • fontFamily: String

      The fontFamily to use for labels and description of features.

    • graphColor: Color

      The color of your axis and labels.

    • showDescription: bool

      Whether to show description at the end of graph.

    • graphOpacity: double

      The opacity of the area under graph.

    • verticalFeatureDirection: bool

      Whether to scroll description vertically or not.

    • descriptionHeight: double

      If scrolling the description vertically, what should be the height of the description box.

    Constructor

    LineGraph({
      @required List<feature> features, 
      @required Size size,
      List<String> labelX: [],
      List<String> labelY: [],
      String fontFamily: 'sans serif',
      Color graphColor: Colors.grey,
      bool showDescription: false,
      double graphOpacity = 0.3,
      bool verticalFeatureDirection = false,
      double descriptionHeight = 80,
    });
    

    Example

    LineGraph(
      features: features,
      size: Size(320, 400),
      labelX: ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5'],
      labelY: ['20%', '40%', '60%', '80%', '100%'],
      showDescription: true,
      graphColor: Colors.white30,
      graphOpacity: 0.2,
      verticalFeatureDirection: true,
      descriptionHeight: 130,
    )
    
  • Creating a list of Features

    • import the Feature model import 'package:draw_graph/models/feature.dart';

    Feature Model

    Properties

    • data: List<double>

      The Y-Axis values to be plotted. Should be in the range [0-1]. The length of the list should be equal to X-Axis labels. (required)

    • title: String

      The title displayed in Feature Description below the graph

    • color: Color

      The color of graph for this feature

    Constructor

    Feature({
      @required List<double> data,
      String title: '',
      Color color: Colors.black,
    });
    

    Example

    List<Feature> features = [
      Feature(
        title: "Drink Water",
        color: Colors.blue,
        data: [0.2, 0.8, 1, 0.7, 0.6],
      ),
      Feature(
        title: "Exercise",
        color: Colors.pink,
        data: [1, 0.8, 6, 0.7, 0.3, 8],
      ),
    ];
    

Getting Started

See the example directory for a sample app using draw_graph.

draw_graph's People

Contributors

dev-roshan-lab avatar dllarsson avatar malihanan avatar

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.