KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
All of the d3 tutorials I've found use data arranged in arrays of objects from which they graph one point for each object in the array. Given data in the following structure: data = [ {id: 1, x: 4, y: 10, type: 1}, {id: 2, x: 5, y: 20, type: 2} ... ] The x and y values are used to make a scatterplot. The type parameter is used to change the color of each point. See this jsfiddle for an example: http://jsfiddle.net/uxbHv/ Unfortuately, I have a different data structure and I can't figure out how to create the same graph by drawing two data points for each object. Here is some example data: dataSet = [ {xVar: 5, yVar1: 90, yVar2: 22}, {xVar: 25, yVar1: 30, yVar2: 25}, {xVar: 45, yVar1: 50, yVar2: 80}, {xVar: 65, yVar1: 55, yVar2: 9}, {xVar: 85, yVar1: 25, yVar2: 95} ] I can graph xVar individually against yVar1 or yVar2, but I can not figure out how to get both on the same graph: http://jsfiddle.net/634QG/
Tags (comma-separated)
Save Edits
Cancel