我想知道是否可以将“字符串”传递到D3Plus散点图的X轴,如下所示:
// 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() // finally, draw the visualization!对于这种配置,我有一个错误:Uncaught : testScale.invert不是一个函数
谢谢!!
发布于 2019-09-19 12:53:58
试试下面的代码:
// 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("value") // key for x-axis
.y("weight") // key for y-axis
.draw() // finally, draw the visualization!https://stackoverflow.com/questions/52501364
复制相似问题