D3Plus Scatter Plot X axis String

28 views
Skip to first unread message

danilo...@gmail.com

unread,
Sep 26, 2018, 1:14:52 AM9/26/18
to d3plus
I like to know if it's possible to pass a "string" to the X axis of a D3Plus Scatter Plot like this:

// sample data array
var sample_data = [
{"value": 100, "weight": .45, "type": "alpha"},
{"value": 70, "weight": .60, "type": "beta"},
{"value": 40, "weight": -.2, "type": "gamma"},
{"value": 15, "weight": .1, "type": "delta"}
]
// instantiate d3plus
var visualization = d3plus.viz()
.container("#viz") // container DIV to hold the visualization
.data(sample_data) // data to use with the visualization
.type("scatter") // visualization type
.id("type") // key for which our data is unique on
.x("type") // key for x-axis
.y("weight") // key for y-axis
.draw()

https://jsfiddle.net/8opdr9t5/1/

with this configuration I have this error Uncaught TypeError: testScale.invert is not a function

Thanks!!

Reply all
Reply to author
Forward
0 new messages