Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Clever_Anjos
Employee
Employee

Error on selecting values

I´m using this piece of code in order to select values inside my extension

svg.selectAll("text")
.data(words)
.enter().append("text")
.style("fill", function (d, i) { return fill(i); })
.attr("text-anchor", "middle")
.on("click", function(d, i) { qv.selectValues(0,[d.text.trim()],true) })
.attr("transform", function (d) { return "translate(" + [d.x, d.y] + ") rotate(" + d.rotate + ")"; })
.style("font-size", function (d) { return d.size + "px"; })
.text(function (d) { return d.text;})
.append("svg:title").text(function (d) { return d.text + ':' + d.value; });

this method qv.selectValues(0,[d.text.trim()],true) is beeing called on 'click' event (please see the attached image), shows the selection toolbar and one error is generated.

Capturar.PNG

Using devTools I could see the error code

<p class="dm-p" q-translation="ErrorCode.-32602">Parâmetros inválidos de protocolo JSON</p>

Could anyone help me?

3 Replies
Not applicable

Hi,

When selecting values you need to refer to the qElemNumber value rather than the text itself. The JSON error you're getting is probably because you're passing a text array to the selectValues function. In your code you need to map the qElemValue from the dimension and use that.

I've forked the solution on git and applied the code, if you'd like to see it working I can commit the changes submit a pull request.

I hope that helps.

Thanks

Nick

Clever_Anjos
Employee
Employee
Author

Please show me your solution

Not applicable

I have submitted a pull request in git with the changes I've made. I may getting a reference to the extension ("Qv" variable) in a different way to you but hopefully it demonstrates how to execute the selection.

Thanks

Nick