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 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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant