GithubHelp home page GithubHelp logo

d3act's People

Contributors

ansavvides avatar cdotta avatar soldair avatar vjo 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

d3act's Issues

Enable creation of custom charts

Have existing d3 charts that you want to drop into React? Let's make it possible for you to make use of d3act's light wrapper so that they get created when the component mounts, update when the component updates and remove when the component is unmounted.

Not compatible with React v15

It worked great with React v0.14.x, but now fails to display charts in React v15.
Console error message:
Uncaught Invariant Violation: traverseParentPath(...): Cannot traverse from and to the same ID,``.

easing enhancement

Any chance of incorporating easing? It is a simple process ..

.delay(function(d, i) {
return i *10
}
.ease('elastic')

But I am still learning your code so not quite sure where it would belong as a global. Somewhere in baseChart I am sure.

d3act is incompatible with React 0.14.0-rc1

Currently it's not possible to use d3act, it fails as follows:

Uncaught Error: Invariant Violation: Chart.render():
A valid ReactComponent must be returned.
You may have returned undefined, an array or some other invalid object.

We are definitely not returning undefined or an array, so for whatever reason it looks like an invalid object is returned from Chart.

Upgrade to d3 4.x

As of v4, d3 has been broken up into many modules (e.g. d3-scale, d3-selection, etc). There are also some API changes.

Not only is it a good idea to stay on the current major version, but the final size would drop quite a bit if d3act only imports the d3 packages it needs.

I've ported a few examples and projects from 3.x to 4.x and it's relatively simple. Changing import d3 from "d3" to import * as d3 from 'd3' then doing a search-and-replace for the new methods names (old: d3.scale.ordinal new: d3.scaleOrdinal, etc) will get you pretty far. Converting to statements like import { scaleLinear, scaleOrdinal } from 'd3-scale' should be the ultimate goal, but I typically save that for a second pass after things are converted and working.

The changes to selections are probably the most substantial but, in my experience, don't take much effort to convert.

Add examples

This should make it a lot easier for people to get up and running. Examples in a README are nice, but they make the README extra long - let's move these to an examples folder where people can actually run the code and see it in action.

Add tests

There are currently no tests in place, which is not ideal.

We should add test coverage for what is already there and any new features will need to be fully tested before they are accepted.

Help needed: handle click

Hi,
how do you handle the click?
I'm trying to create a pie chart and handle the click on each part.
Thank you for your help

No chart(s) displaying

HI, I have an application using react-router. I've tried implementing a basic example chart class as in the demo:

import React from 'react';
import * as d3 from 'd3';
import Chart from 'd3act';

class D3Muckaround extends React.Component {
render() {
return (
<Chart
type={"pie"}
width={300}
height={300}
showTooltips={true}
data={
{
"React": 2,
"Relay": 12,
"GraphQL": 5,
}
}
/>
);
}
}
export default D3Muckaround;

However it's displaying nothing. Do I have to be specific in letting it know where to mount to the DOM or something? Any help would be greatly appreciated thanks!

Tooltip position issue in Firefox

The tooltip has no position set, so it appear at the bottom of the chart in Firefox, see this screenshot:

screen shot 2015-11-01 at 18 17 39

By looking into the JS console when running the examples, I have this error:

ReferenceError: event is not defined                     app.js:29752:18

It comes from BaseChart.js line 57 and 58:

onMouseMove() {
    if (!this.showTooltips) {
        return;
    }

    const top = (event.pageY - 10); // line 57
    const left = (event.pageX + 10); // line 58
...

In short window.event doesn't exist in Firefox, the work around would be to use the d3.event instead.

Tooltip not showing up although visible in code

I deconstructed your repository to examine it in dev mode:

  1. Made your app.jsx my main render component.
  2. Replaced links to ./lib to ./components

App works, although the tool tips are not showing up, although clearly working in code (hidden is replaced with visible).

Before mouseover:
< div class="tooltip" style="position: absolute; z-index: 10; visibility: hidden; border: 1px solid grey; border-radius: 3px; text-align: center; padding: 8px 0px; width: 100px; color: rgb(255, 255, 255); top: 375px; left: 401px; background-color: rgb(0, 0, 0);">Relay (12)< /div>

On mouseover:

< div class="tooltip" style="position: absolute; z-index: 10; visibility: visible; border: 1px solid grey; border-radius: 3px; text-align: center; padding: 8px 0px; width: 100px; color: rgb(255, 255, 255); top: 375px; left: 401px; background-color: rgb(0, 0, 0);">Relay (12)< /div>

Any ideas?

line chart

This is great! Any ideas on how to implement a line chart?

Add ability to include legends

This should make it a lot easier to read data for things like pie charts where unless you hover you don't know what you are looking at.

Add better error handling

Right now, it's all a little bit of magic; if you don't pass everything that's required to the Chart component, you won't know what's gone wrong. We should raise some informative errors to make it easier to figure out what's going wrong.

Adding new values to PieChart doesn't render correctly

In essence, a new path is not added to the DOM.

Simple reproduction example:

class ExampleDonutChart extends React.Component {
    constructor(props) {
        super(props);

        this.state = {
            data: {
                "React": 2,
                "Babel": 5,
            }
        };
    }

    componentDidMount() {
        window.setTimeout(() => {
            this.setState({
                data: {
                    "React": 2,
                    "Babel": 5,
                    "Radium": 6
                }
            })
        }, 2000);
    }

    render() {
        return (
            <div>
                <h2>Donut Chart</h2>
                <Chart
                    type={"pie"}
                    width={300}
                    height={300}
                    innerRadius={100}
                    showTooltips={true}
                    data={this.state.data}
                />
            </div>
        );
    }

}

Make customisable props more extensible

Currently, we do the following in BaseChart:

this.showTooltips = this.props.showTooltips ? true : false;
this.transitionDuration = this.props.transitionDuration || 1000;

Let's instead move this information to an object like this:

const customisableProps = {
    showTooltips: true,
    transitionDuration: 1000
};

This way we'll have a default value per customisable prop and we can just add to that object when we want to add another prop.

We can then just iterate through each key and make the necessary assignments in the BaseChart constructor.

Make tooltips customisable

Currently, the tooltips are not customisable; we should change that so that people can implement tooltips the way they want them to be. We should let people have control over how the tooltips look (style) and what information they contain (content).

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.