Coder Social home page Coder Social logo

react-d3.github.io's People

Contributors

abdellah-neo avatar chihsuan avatar chilijung 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-d3.github.io's Issues

Documentation is mysterious

on the front page of this site you have this code. Where is "Line" defined, core? basic? I cant seem to find anything related to this anywhere or any documentation related how to replicate something like this very first example on your site.


  <Chart
    width= {width}
    height= {height}
    data= {data}
    chartSeries= {chartSeries}
    x= {x}
    >
    // build line chart
    <Line
      chartSeries= {series1}
    />
    // build area chart
    <Area
      chartSeries= {series2}
    />
    <Xaxis/>
    <Yaxis/>
    <Xgrid/>
    <Ygrid/>
  </Chart>

Unpleasant color scheme for demos

While in no doubt the code is excellent, the selected color scheme in the demo is more than displeasing.
I would recommend taking the time to showcase better-looking examples.
Personally I will choose one package over another if its example page show nice, pretty, examples.

Previews are broken

In at least Chrome 44 on Mac, there are 4 errors being thrown stopping the previews from being rendered. They are all Uncaught TypeError: Object.assign is not a function for:

  • line_garbage.min.js
  • bar_group_brush.min.js
  • bar_stack_zoom.min.js
  • pie_tooltip.min.js

Just a heads up as it makes the library look less impressive ;)

Getting started using JSPM

Hi folks I wanted to share how you can go through your getting started using JSPM. Benefits include no manual config file and es6 out of the box.

Use the same data source.

Installation of jspm & dependencies:

npm init -y
npm install -D jspm
jspm init -y
jspm install [email protected] [email protected]  npm:react-d3-core npm:react-d3-basic json

HTML file: index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>React D3 getting started</title>
    <script src="jspm_packages/system.js" charset="utf-8"></script>
    <script src="config.js" charset="utf-8"></script>
    <script type="text/javascript">
      System.import('./main.js');
    </script>
  </head>
  <body>
    <div id="chart"></div>
  </body>
</html>

Javascript file: main.js

import chartData from './user_sample.json!';
import React from 'react';
import ReactDOM from 'react-dom';
import { LineChart } from 'react-d3-basic';
// loading chart data from json file using json-plugin
import chartData from './user_sample.json!';

const width = 700;
const height = 300;
const margins = { left: 100, right: 100, top: 50, bottom: 50 };
const title = 'User sample';
// chart series,
// field: is what field your data want to be selected
// name: the name of the field that display in legend
// color: what color is the line
const chartSeries = [
  {
    field: 'BMI',
    name: 'BMI',
    color: '#ff7f0e'
  }
];
// your x accessor
const x = (d) => d.index;

// Leaving out the Chart from the regular getting started because it didn't 
// nest the LineChart inside it properly and it didn't seem to be necessary. 
ReactDOM.render(
  <LineChart
    margins={margins}
    title={title}
    data={chartData}
    width={width}
    height={height}
    chartSeries={chartSeries}
    x={x}
  />
, document.getElementById('chart')
);

Now you can serve the folder in a web server and visit this index.html in a browser.

You can also easily create a useful npm start with a webserver and hot reloading by:

npm install -D serve chokidar-socket-emitter

Alter index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>React D3 getting started</title>
    <script src="../../jspm_packages/system.js" charset="utf-8"></script>
    <script src="../../config.js" charset="utf-8"></script>
    <script type="text/javascript">
      System.trace = true;
      System.import('systemjs-hot-reloader/default-listener.js');
      System.import('./index.js');
    </script>
  </head>
  <body>
    <div id="chart"></div>
  </body>
</html>

Add npm script:

  "scripts": {
    "start": "serve & chokidar-socket-emitter"
  },

Now you can run npm start and visit localhost:3000

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.