Inserting non-numeric data into an array for a scatterplot

1 Answer 67 Views
Charts
Napoleon
Top achievements
Rank 1
Napoleon asked on 17 Mar 2022, 03:02 PM
0

I am trying to display a scatterplot from a variable called datadata should contain the x and y values for the scatterplot. The method below is what I am attempting to do to insert the x and y values, however the graph is showing up blank.


let data = []
for(var i = 0; i < sixth_x.length; ++i){

  data.push({xField: sixth_x[i], yField: sixth_y[i]})

}

x is a string, and y is a number. I realize that x is non-numeric, although upon converting to an int, it still fails to display on a scatterplot. Any suggestions would be helpful

This is my method to display the graph


  <ChartSeriesItem type="scatter" data={data} xField="sixth_x"
    yField="sixth_y"/>
</ChartSeries>

1 Answer, 1 is accepted

Sort by
1
Accepted
Filip
Telerik team
answered on 18 Mar 2022, 01:46 PM

Hi, Napoleon,

Upon inspecting the provided code snippet we noticed that the mapping for the xField and yField props is using different fields. The actual fields names in the object are xField yField

It should look like this in order for the scatterplot to appear:

 

<ChartSeriesItem type="scatter" data={data} xField="xField"
yField="yField"/>

 

I hope this helps.

Regards, FilipProgress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Napoleon
Top achievements
Rank 1
commented on 18 Mar 2022, 02:25 PM

Thank you Filip!
Tags
Charts
Asked by
Napoleon
Top achievements
Rank 1
Answers by
Filip
Telerik team
Share this question
or