GithubHelp home page GithubHelp logo

d3by5-base-chart's Introduction

d3by5-base-chart

The base class for all d3by5 charts. This base implements the shared functionality of graphs build acording to Mike Bostocks, Towards Reusable Charts

All methods operate as getters/setters. Providing a value will set it and return the chart object for chaining. Calling the method without arguments will return the current value

API

Required values

  • width - {Number} - the height of the chart (required)
  • height - {Number} - the width of the chart (required)
  • data - {Array} - the data that produces the chart (required)

Optional values

  • fillColor - {Mixed} - sets the fillcolor for a chart, this can be an Array of hex-strings/named colors or a single hex-string/named color
  • margin - {Mixed} will set margins on the chart, the input data can be
    • Number - Any valid number following css standard settings, can be 1, 2, 3 or 4 numbers separated by ,
    • Object - {top, right, bottom, left}
  • padding - {Number} - sets the padding, no real use for this value yet
  • on - {String, Function} - sets a listener all supported dom events

Utilities

  • remove - removes the chart from stage
  • getCalculatedHeight returns the height without margin top and bottom
  • getCalculatedWidth returns the width without margin left and right
  • _createMargins - used by margin to create valid object (top, left, bottom, right)
  • _parseData - entry point for dataparsing, used by data and implements _getColorAccessor, _mapData and _getDataDimensions
  • _mapData - dafault mapping of data to valid format
  • _getColorAccessor - created a color accessor function for setting colors
  • _getDataDimensions - checks the layout of data (if single or multiple dimensions)

License

MIT

d3by5-base-chart's People

Contributors

bardrotzer avatar svale avatar

Watchers

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