GithubHelp home page GithubHelp logo

soumsps / html-canvas-library Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 415 KB

It's an attempt to build a reusable charting library built upon HTML5 canvas

Home Page: https://charts-soumsps.netlify.app/

JavaScript 90.95% HTML 6.35% CSS 2.70%

html-canvas-library's Introduction

Instructions

You have to create a plotting library that can render a few types of graphs.

Mandatory Features

  • Should at least have a Bar and Line chart feature.
  • The data should be generic and can be fed by the user in a convenient form.
    • No data should be hard-coded.
  • The API that you will expose to the developer is your choice.

Documentation ๐Ÿ“š

Usage

Step 1. Import NiceCharts

Step 2. Create chart object and pass it to as a prop name chartOptions.

import React from 'react';
import NiceCharts from '../../components/nice-charts-lib/nice-charts.component';

const LineExample1 = () => {
  const options = {
    chartTitle: 'Wildlife Population',
    chartType: 'line',
    chartWidth: 650,
    chartHeight: 450,
    chartBackgroundColor: '#f3f3f3',
    axisY: {
      title: 'Population in crores',
      scale: 'auto',
      segments: 5,
    },
    axisX: {
      title: 'Years',
      scale: [2014, 2015, 2016, 2017, 2018, 2019],
    },
    data: [
      {
        label: 'Bears',
        color: 'red',
        data: [
          [2014, 5],
          [2015, 50],
          [2016, 85],
          [2017, 114],
          [2018, 140],
          [2019, 182],
        ],
      },
      {
        label: 'Dolphins',
        color: 'blue',
        data: [
          [2014, 140],
          [2015, 77],
          [2016, 25],
          [2017, 11],
          [2018, 34],
          [2019, 5],
        ],
      },
    ],
  };
  return (
    <div>
      <h3>Line chart Example</h3>
      <NiceCharts chartOptions={options} />
    </div>
  );
};

export default LineExample1;

APIs provided by Nice Charts

Property isRequired Type Default Help
chartTitle false string '' This will be shown as chart title canvas top.
chartType true string none Currently supported 'line' & 'bar'
chartWidth false number 600 Number is in pixel.
chartHeight false number 400 Number is in pixel.
chartBackgroundColor false string #f3f3f3 Enter vaild color, also can give color like 'grey', 'red'
axisX & axisY true object none Contains title, scale, and segments property
title --- --- --- Not implemented yet
scale true string / array none Can have 'auto' for automatic axis scaling
or user can provide predefined axis scale as array.
segments false number 5 Desired number of axis segments.
data true array none Array of object (contains label, color, data)
label --- --- --- Not implemented yet
color false string random color Enter vaild color, also can give color like 'grey', 'red'
data true array none Array of arrays (relative x,y co-ortinates)

html-canvas-library's People

Contributors

soumsps avatar v1kasjain avatar arfatsalman avatar

Stargazers

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