From 7c2ad67c1f10058637ab56a2dfe0273fb886a2da Mon Sep 17 00:00:00 2001 From: Lauren Date: Wed, 9 Dec 2015 16:13:25 -0800 Subject: [PATCH] filter 0 from default x data, clean up demo --- demo/app.jsx | 55 +++++++++++++++++++-------------- src/components/victory-line.jsx | 3 +- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/demo/app.jsx b/demo/app.jsx index 8321f9b..45bc812 100644 --- a/demo/app.jsx +++ b/demo/app.jsx @@ -5,6 +5,7 @@ import ReactDOM from "react-dom"; import {VictoryLine} from "../src/index"; import _ from "lodash"; import {VictoryLabel} from "victory-label"; +import d3Scale from "d3-scale"; class App extends React.Component { constructor(props) { @@ -48,38 +49,44 @@ class App extends React.Component { return (
- Math.sin(2 * Math.PI * x)} - labelComponent={{"label\ntwo"}} - sample={25} - /> + Math.sin(2 * Math.PI * x)} + labelComponent={{"label\ntwo"}} + sample={25} + /> - x * x} - /> + x * x} + /> - + - +
); } diff --git a/src/components/victory-line.jsx b/src/components/victory-line.jsx index ca65828..f6cce83 100644 --- a/src/components/victory-line.jsx +++ b/src/components/victory-line.jsx @@ -271,7 +271,8 @@ export default class VictoryLine extends React.Component { const step = _.max(domain) / samples; // return an array of x values spaced across the domain, // include the maximum of the domain - return _.union(_.range(_.min(domain), _.max(domain), step), [_.max(domain)]); + const xArray = _.union(_.range(_.min(domain), _.max(domain), step), [_.max(domain)]); + return _.filter(xArray, (x) => x !== 0); } returnOrGenerateY(props, x) {