0
if(this.state.chartCategory == 'D3Chart'){
      console.log("chartdata for d3 charts", this.state.d3line.chartData);

        switch(this.state.chartType){
          case 'area': return <div  style={{width: 900, height:300}}><Areagraph  data = {this.state.d3line.chartData} vars = {{x: this.state.d3line.x, y: this.state.d3line.y}} dispatch = {this.showFilter} title = {this.state.data.chartName}/></div>;
          case 'pie': return  <div style={{width: 900, height:500}}><Piegraph  data = {this.state.d3line.chartData} vars = {{x: this.state.d3line.x, y: this.state.d3line.y}} dispatch = {this.showFilter} title = {this.state.data.chartName}/></div>;
          case 'bar': return  <div  style={{width: 900, height:300}}><Bargraph  data = {this.state.d3line.chartData} vars = {{x: this.state.d3line.x, y: this.state.d3line.y}} dispatch = {this.showFilter} title = {this.state.data.chartName}/></div>;
          /*case 'column': return  <div className = "graphContainer" style={{width: 900, height:300, overflow: "hidden", resize: "both", paddingBottom: "10px", border: "1px solid black"}}><Columngraph  data = {this.state.d3line.chartData} vars = {{x: this.state.d3line.x, y: this.state.d3line.y}} dispatch = {this.showFilter} title = {this.state.data.chartName}/></div>;*/
          case 'line' : return <div  style={{width: 900, height:300}}><Linegraph  data = {this.state.d3line.chartData} vars = {{x:this.state.d3line.x, y: this.state.d3line.y, group: this.state.d3line.x}} dispatch = {this.showFilter} title = {this.state.data.chartName}/></div>;
          default: return null;
       }   

    }

In the console I am printing the data which i want to convert from string to integerIf number, convert string to integer, number also taking as string, How to convert into number need to remove " "

If you check in the picture I need to convert, if it a number alone

siva
  • 45
  • 1
  • 2
  • 12
  • have a look [here](https://stackoverflow.com/questions/1133770/how-do-i-convert-a-string-into-an-integer-in-javascript) – ztadic91 Nov 24 '17 at 08:48
  • 3
    Possible duplicate of [How do I convert a string into an integer in JavaScript?](https://stackoverflow.com/questions/1133770/how-do-i-convert-a-string-into-an-integer-in-javascript) – ztadic91 Nov 24 '17 at 08:49
  • Possible duplicate of [How to convert string to integer from json response in reactjs](https://stackoverflow.com/questions/47471201/how-to-convert-string-to-integer-from-json-response-in-reactjs) – Timothy Groote Nov 24 '17 at 10:35

1 Answers1

1

I'm not really sure if this really is different using ReactJs, but did you try to parseInt() the strings?

I'm not really understanding what you are trying to do, but the most simple way for type-conversion would be the native functions of Javascript!?

https://www.w3schools.com/jsref/jsref_parseint.asp

bquarta
  • 559
  • 6
  • 19