Add LineChart Component#30
Open
yunseop-kim wants to merge 3 commits into
Open
Conversation
AnSavvides
requested changes
May 23, 2017
AnSavvides
left a comment
Owner
There was a problem hiding this comment.
Thanks for taking the time to do this, @yunseop-kim! I left a few comments for bits and pieces you can remove to make LineChart.js a little cleaner and without any debugging code like console.log.
It would also be wonderful if you could add a couple of examples! Check out the /examples/ folder and add an example in app.jsx - nice and quick way to showcase how this new line chart works and looks!
| @@ -0,0 +1,152 @@ | |||
| import * as d3 from "d3"; | |||
| import BaseChart from './BaseChart'; | |||
| // import {line} from 'd3-shape'; | |||
| // import {line} from 'd3-shape'; | ||
|
|
||
| export default class LineChart extends BaseChart { | ||
| getScaleX() { // * |
| return d3.scaleTime().range([0, this.props.width]); | ||
| } | ||
|
|
||
| getScaleY() { // * |
| return d3.scaleLinear().range([this.props.height, 0]); | ||
| } | ||
|
|
||
| createAxisX(x) { // * |
| return d3.axisBottom(x); | ||
| } | ||
|
|
||
| createAxisY(y) { // * |
| const y = this.getScaleY(); | ||
|
|
||
| this.xAxis = this.createAxisX(x);// | ||
| this.yAxis = this.createAxisY(y);// |
Owner
There was a problem hiding this comment.
Let's remove the // from these two lines.
| d.y = +d.y; | ||
| }); | ||
|
|
||
| console.log("data:", data); |
Author
|
@AnSavvides I removed unnecessary comments and added LineChart Example! Please review the source. :D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello, Thanks for providing the good open source for us.
I added a line chart component, and it would be a pleasure for me if you review this source and merge it.
Have a good day!