Giter Club home page Giter Club logo

britecharts's Introduction

Britecharts

Britecharts is a client-side reusable Charting Library based on D3.js v5 that offers easy and intuitive use of charts and components that can be composed together to create amazing visualizations.

Build Status npm version License PRs Welcome All Contributors Twitter Follow

Bar Chart Line Chart Donut Chart
Stacked Bar Chart Stacked Area Chart Grouped Bar Chart
Sparkline Chart Legend Chart Brush Chart

Britecharts components have been written in ES2016 with a Test Driven methodology, so they are fully tested, and we are committed to keeping them that way.

Key Features

  • Reusability
  • Composability
  • Great design

Usage

The typical use of Britecharts involves creating a chart using its simple API, then rendering it on a container which has previously had data applied to it. The code will look like this:

barChart
    .width(500)
    .height(300);

barContainer.datum(dataset).call(barChart);

API

All the components expose some common API methods like width, height, and margin. Additionally, each chart or component can expose specific methods you can find in the documentation:

Installation

Britecharts components are distributed in UMD modules, each one exposing a D3.js component written with the Reusable API pattern. To use any of the Britecharts modules, you will need to require the chart in your JS file using AMD/CommonJS modules or adding a script tag with the src pointing to the file. You would also need to load the d3-selection submodule to select the chart container.

   npm install britecharts d3-selection

You can also load Britecharts from our CDN as we do in this demo page or play around in our JSBin and CodePen demo projects.

They also provide some minimal CSS styling, that can be loaded independently or as a bundle. Check our Styling Britecharts tutorial to see more options.

See Also

Community Roadmap

This project is in active development. We want your input about what is important, for that, add your votes using the πŸ‘ reaction:

To give your feedback, you can open a new issue. You can also find us in the D3.js slack group, in the #britecharts channel. If you want to help, you can check the contributing guide.

If you work with Angular, check out ngx-britecharts and their demos. We are also preparing a wrapper for React, and we will be talking about it on our twitter.

Acknowledgments

Sun Dai designs Britecharts, and two books inspired the code, Developing a D3.js Edge and Mastering D3.js. It also leveraged a significant number of examples and articles from the D3.js community overall.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Daler Asrorov

πŸ’» πŸ“– πŸ€” 🚧 πŸ‘€ ⚠️

Ryan Wholey

πŸ’» πŸ“– πŸ€” 🚧 πŸ‘€ ⚠️

jchen85

πŸ’» πŸ€” 🚧 πŸ‘€ ⚠️

Marcos GΓ³mez

πŸ’»

ajdani

πŸ› πŸ’» 🚧

shayh

πŸ’»

Jay Clark

πŸ’»

Brendan Ratter

πŸ’» πŸ€”

Rajesh

πŸ’»

Alexis Crespo

πŸ’»

Gago

πŸ’» πŸ–‹ πŸ€” πŸš‡ 🚧 πŸ‘€ πŸ”§ ⚠️

This project follows the all-contributors specification. Contributions of any kind are welcome!

License

Copyright 2019 Eventbrite

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Read more in the license document

britecharts's People

Contributors

adrm avatar ajdani avatar allcontributors[bot] avatar amber-eb avatar bung87 avatar constantinoschillebeeckx avatar cwalker-eb avatar dalerasrorov avatar dependabot[bot] avatar evb-sun avatar flacoman91 avatar golodhros avatar grayt0r avatar imadrafter avatar jchen85 avatar jenjwong avatar maikdiepenbroek avatar martinmanzo avatar matthieu-hm avatar mhammo avatar miglesiaseb avatar mikerhyssmith avatar namoscato avatar nobitagit avatar perborgen avatar pluehne avatar rajeshmr82 avatar ryanwholey avatar shayh avatar violetlight 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  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

britecharts's Issues

Stacked area displays wrong color cursor ball at times

The stacked area chart will sometimes display the wrong color ball

Expected Behavior

we would expect the ball to be the color of the shape below it

Current Behavior

ball defaults to the last color in the colorset when there is only one ball to render

Possible Solution

Probably the order the ball is being rendered? or maybe its the way we choose the default ball color

Steps to Reproduce (for bugs)

image

Your Environment

  • Version used: 1.4.4
  • Browser Name and version: Chrome

Britecharts complete build doesn't provide the right structure

When loading /dist/bundled/britecharts.min.js, either by ES6 imports, commonJS modules or AMD modules we are not getting the expected results.

Expected Behavior

We should get an object with this structure:

  britecharts: {
    bar: function...
    brush: function...
    ...
  }

Current Behavior

Either getting just the first object or nothing being imported to the global scope (in script mode)

Possible Solution

Right now, our individual charts are exporting the right object (AMD and CommonJS) or a global object (script load) with this shape: window.britecharts.chartName

We want the whole bundle to do the same, aggregating all the charts in an object named britecharts.
This way we should be able to do:

   import britehcarts from 'britecharts';
   import {bar} from 'britecharts';

or

   <script src="/dist/bundle/britecharts.min.js"></script>
   ...
   var barChart = window.britecharts.bar;

I hope the solution would be something we haven't tried yet on our webpack configuration.
prodUMD poduces our individual bundles all right
prod should produce the desired outcome. Right now looks like:

  prod: {
        entry:  {
            britecharts: currentChartsArray
        },
        devtool: 'source-map',
        output: {
            path: 'dist/bundled',
            filename: projectName + '.min.js',
            library: ['britecharts'],
            libraryTarget: 'umd'
        },
        externals: {
            d3: 'd3',
            underscore: 'underscore'
        },
        module: {
            loaders: [ defaultJSLoader ],
            // Tell Webpack not to parse certain modules.
            noParse: [
                new RegExp(vendorsPath + '/d3/d3.js')
            ]
        },
        resolve: {
            alias: {
                d3: vendorsPath + '/d3'
            }
        },
        plugins
    }

Steps to Reproduce (for bugs)

  1. Load /dist/bundle/britecharts.min.js
  2. Check what gives back

Context

This actually makes our bundle unusable.

Brush chart styling has solid slection area

When selecting dates for the brush, the selection area is a solid opaque rectangle instead of the chart highlight

Expected Behavior

we should see the chart highlight, not an opaque selection rectangle

Possible Solution

brush styling

Steps to Reproduce (for bugs)

  1. Go to the kitchen sink
  2. play with the brush

Your Environment

  • Version used: 1.4.4
  • Browser Name and version: Chrome
  • Operating System and version (desktop or mobile): mac osx

image

Nicer data for Stacked Area Demo

We need to get a nicer dataset for the stacked area chart demo. The current set results in an almost psychedelic effect with all the colors, it should be something more smooth.

maybe use any of the data generation projects out there?

Tooltip rework

We want to make the tooltip smart about the data he shows.
Designs coming soon.

SVG Creation Helper

The SVG creation snippet is being repeated continuously, we should extract it into a helper.

Need a REALLY Basic HTML Page

I was hoping to be able to create a very simple single HTML page with a single chart or two so that the designers could do their thing and then we can incorporate their designs in Angular.

Is there any way to link a simple script tag with a src to have a single page with a chart?

With d3, the following works fine... it'd be great to have something similar.

<!DOCTYPE html>
<html>
  <head>
 <meta charset='utf-8' />
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <script src="https://d3js.org/d3-selection.v1.min.js"></script>
  </head>
  <body>
    <div id='charts'>
      <h1 id='heading'></h1>
    </div>
    <script>
      d3.select('#heading')
        .text('My Page');
    </script>
  </body>
</html>

Create Sparkline variation based on Tufte sparkline

We want to have a sparkline that works along with text.
The inspiration for this comes from Tufte's Beautiful Evidence book.

It should have a size related to font sizes, with a probable 'tunning' factor in order to support different font faces.

Extract transitions into library

Extract transitions into functions, follow:

var t = d3.transition()
.duration(750)
.ease(d3.easeLinear);
d3.selectAll(".apple").transition(t)
.style("fill", "red");
d3.selectAll(".orange").transition(t)
.style("fill", "orange");

We need to explore which transitions we will want to support.

Error with npm install on project

After getting sources from npm install britecharts d3-selection command, and trying to install dependencies on britecharts I get the following error:

$ npm install
npm WARN deprecated [email protected]: Package is deprecated, use https://github.com/deepsweet/istanbul-instrumenter-loader
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:206:12)
npm WARN addRemoteGit     at emitTwo (events.js:106:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:877:16)
npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:334:11)
npm WARN addRemoteGit     at emitOne (events.js:96:13)
npm WARN addRemoteGit     at Socket.emit (events.js:188:7)
npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:498:12)
npm WARN addRemoteGit  git://github.com/beevelop/grunt-release.git resetting remote C:\Users\Ludovic\AppData\Roaming\npm-cache\_git-remotes\git-github-com-beevelop-grunt-release-git-f3dd0c51 because of error: { Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:206:12)
npm WARN addRemoteGit     at emitTwo (events.js:106:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:877:16)
npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:334:11)
npm WARN addRemoteGit     at emitOne (events.js:96:13)
npm WARN addRemoteGit     at Socket.emit (events.js:188:7)
npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:498:12)
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:206:12)
npm WARN addRemoteGit     at emitTwo (events.js:106:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:877:16)
npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:334:11)
npm WARN addRemoteGit     at emitOne (events.js:96:13)
npm WARN addRemoteGit     at Socket.emit (events.js:188:7)
npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:498:12)
npm WARN addRemoteGit  requirejs/text resetting remote C:\Users\Ludovic\AppData\Roaming\npm-cache\_git-remotes\git-github-com-requirejs-text-git-37804fea because of error: { Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:206:12)
npm WARN addRemoteGit     at emitTwo (events.js:106:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:877:16)
npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:334:11)
npm WARN addRemoteGit     at emitOne (events.js:96:13)
npm WARN addRemoteGit     at Socket.emit (events.js:188:7)
npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:498:12)
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }

I expect to have dependencies installed and to build the library into dist/ folder using npm run prodcommand line.

Environment

  • Britecharts: latest using npm install britecharts d3-selection
  • Node version: 6.9.1
  • NPM version: 3.10.8
  • Operating System and version (desktop or mobile): Windows 10

All Styling via JavaScript

This one needs some discussion.

We like:

  • The theme changing using the extended colors
  • The removal of a css dependency while keeping the styles
  • The option of change themes for ticks, labels, tooltips, etc
  • The option of setting the font as an options

We don't like:

  • The use of JS to style (but we need to do it anyways)

Improving navigation on docs: breadcrumbs

We want to add some extra help navigating the docs
This could come as a breadcrumb on each doc page

Expected Behavior

We would see a breadcrumb on demos, API reference pages and documents

Current Behavior

We need to go back to the home page or use the menu

Context

We have received feedback that the navigation in the docs can be a bit confusing

Britecharts based one page Reports

We want to create a boilerplate project for creating Britecharts based reports. It will be an easy way of creating an easily deployable report using our charts.

The target audience could be users wanting to create private or public reports for companies, education, science results, etc.

Technically, it could be based on one of the popular boilerplate OSS and probably some other lightweight UI framework. We could add ansible configurations for using the most popular cloud services (Digital Ocean, Heroku...). It could also be a Yeoman generator.

Make charts responsive by default

Right now, in our demos we use a small helper to debounce a listener to the 'resize' event of it's container. This makes it possible to redraw our chart and make it responsive. Any developer would need to do the same to get a responsive chart.

We could easily move that logic inside our charts, making the debounce delay configurable. Or even the method (debounce or throttle).

Stacked Bar Chart

We want to create an stacked bar chart.

The current design for it would looke like:
stacked-bar-chart-green

New Chart: Create Sankey diagram

Sankey charts graphically illustrates distribution or a flow (example: traffic, money, energy etc) and is a good way for users to digest categorized quantities. A good example of Sankey diagram: http://usafacts.org/the-big-picture?view=spending

Marketing can benefit greatly from this chart and utilize it on mini-sites, marketing landing pages and blogs to offer user an interactive experience; product can also use this to offer organizer insights on user activities during a checkout flow (where do they come from, where do they drop off if the transaction fell through etc.)

Some references:
https://developers.google.com/chart/interactive/docs/gallery/sankey#overview
https://bost.ocks.org/mike/sankey/
http://usafacts.org/the-big-picture?view=revenue

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.