Giter VIP home page Giter VIP logo

react-vizgrammar's Introduction

React-VizGrammar

React VizGrammar is a wrapper around Victory JS and it makes charting easier by adding boilerplate code so that designers and developers can get started and set it up in a few minutes.

A chart can be embedded in a React environment simply by using the VizG react component.

    import VizG from 'react-vizgrammar';

    <VizG config={config} data={data} metadata={metadata} />

where the props

  • config is the widget configurations specified as a JSON object.
  • data is the array of data sets fed to the charts.
  • metadata is the JSON object that contains information about the provided dataset.

checkout the samples and documentation

Chart config prop

Users have to provide parameters for the widget using config object inorder to create the chart type they require. It is a JSON object that has a well defined configuration attributes to customize the chart.

Following is a basic configuration to plot a line chart,

    let config = {
        x : "rpm",
        charts : [{type: "line",  y : "torque", color: "EngineType"}],
        maxLength: 10,
        width: 400,
        height: 200
    }

metadata prop and data prop

Once the config is provided. User can provide a dataset to visualize the chart. For easy interpretation React-VizGrammar require this dataset to be arranged in a tabular way similar to the way explained below.

    metadata = {
        "names": ["Column1", "Column2",...],
        "types": ['ordinal', 'linear',...]
    };

metadata.names is an array consists of column names/fields of the table and metadata.types contains their types (ordinal, time or linear), names and types are aligned together in a way that "Column1" => 'ordinal' and "Column2" => 'linear' and so on.

    data = [
        ["value1", numericValue1,...],
        ["value2", numericValue2,...],
    ];

data collection of arrays of data rows. Single row is stored as an array and their element order follows the order of metadata.names.

Sample data table would be like following:

    metadata = {
        "names" : ["rpm","torque","horsepower", "EngineType"],
        "types" : ["linear","linear", "ordinal","ordinal"]
    };

    data = [
        [8000, 75, 120, "Piston"], [9000, 81, 130, "Rotary"]
    ];

Build Process

Prerequisites

  • NPM
  • Node

These prerequisites must be installed before proceeding with the build process.

Build the Library

In order build React-VizGrammar from the sources, Get a clone from this repository and then run the following commands in the terminal from the react-vizgrammar directory.

    npm install
    npm run build

Build and run samples

To build and start the dev-server and view the samples, inside the main directory run the following command afer installing the npm dependencies.

    npm run samples

react-vizgrammar's People

Contributors

charukak avatar erangatl avatar thusithak avatar this avatar nisalaniroshana avatar tanyam avatar lasanthas avatar suhothayan avatar maheshika avatar mohanvive avatar ramindu90 avatar tishan89 avatar

Watchers

James Cloos avatar  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.