The Wayback Machine - https://web.archive.org/web/20201106134818/https://github.com/shutterstock/rickshaw/issues/583
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaled series render "null" as "0" #583

Open
pstanton opened this issue Jul 28, 2017 · 2 comments
Open

Scaled series render "null" as "0" #583

pstanton opened this issue Jul 28, 2017 · 2 comments

Comments

@pstanton
Copy link

@pstanton pstanton commented Jul 28, 2017

null should be preserved and treated as they are when not using scale - which is to create a gap in the line or terminate the line at the last non null point

var palette = new Rickshaw.Color.Palette();
var graph = new Rickshaw.Graph( {
	element: document.getElementById("chart"),
	renderer: 'line',
	interpolation: 'cardinal',
	series: [
		{
			data: [ { x: 0, y: 19 }, { x: 1, y: 30 }, { x: 2, y: 22 }, { x: 3, y: 29 }, { x: 4, y: 26 }, { x: 5, y: 35 } ],
			name: 'new york',
			color: palette.color(),
			scale:d3.scale.linear().domain([1, 50]).nice()
		}, {
			data: [ { x: 0, y: 49 }, { x: 1, y: 35 }, { x: 2, y: 32 }, { x: 3, y: 38 }, { x: 4, y: 37 } ],
			name: 'boston',
			color: palette.color(),
			scale:d3.scale.linear().domain([1, 50]).nice()
		}, {
			data: [ { x: 0, y: 19 }, { x: 1, y: 22 }, { x: 2, y: 10 }, { x: 4, y: null }, { x: 5, y: 17 } ],
			name: 'los angeles',
			color: palette.color(),
			scale:d3.scale.linear().domain([1, 50]).nice()
		}, {
			data: [ { x: 1, y: 9 }, { x: 2, y: 3 }, { x: 3, y: 50 }, { x: 4, y: null } ],
			name: 'san francisco',
			color: palette.color(),
			scale:d3.scale.linear().domain([1, 50]).nice()
		}
	]
} );
graph.render();
new Rickshaw.Graph.HoverDetail({ graph: graph });
@pstanton
Copy link
Author

@pstanton pstanton commented Jul 28, 2017

in Rickshaw.Graph.stackData

change

					seriesData.forEach( function(d) {
						d.y = series.scale(d.y);
					} );

to

					seriesData.forEach( function(d) {
						if (d.y != null)
							d.y = series.scale(d.y);
					} );
@pstanton
Copy link
Author

@pstanton pstanton commented Jul 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.