javascript - Scatter google chart - string values in Y axis -


since yesterday try draw chart google charts. have 1 problem. tried put strings on y-axis, , script doesn't display anything.

i tried code:

<script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1.1', {packages: ['scatter']}); google.setonloadcallback(drawchart);  function drawchart () {  var data = new google.visualization.datatable(); data.addcolumn('number', 'document'); data.addcolumn('string', 'term');  data.addrows([          [1 , 'word1'] , [3 , 'word2'] ]); var options = {     width: 900,     height: 500,     chart: {         title: 'weight of terms'     },     axes: {         x: {               0: {side: 'bottom'}           }           }     };  var chart = new google.charts.scatter(document.getelementbyid('scatter_top_x'));   chart.draw(data, google.charts.scatter.convertoptions(options)); } </script> 

that gives me result: http://darium.linuxpl.eu/chart/

the goal: wanna draw sometnig this-

https://www.imageupload.co.uk/images/2015/08/25/asd.png

is there way draw want?

data column(s) axis #0 cannot of type string

so need change axis,

google.load('visualization', '1.1', {packages: ['scatter']});  google.setonloadcallback(drawchart);    function drawchart () {    var data = new google.visualization.datatable();  	data.addcolumn('string', 'term');      data.addcolumn('number', 'document');    	data.addrows([           ['word1', 1] , ['word2', 3]  	]);        var options = {      width: 900,      height: 500,      chart: {          title: 'weight of terms'      },      axes: {          x: {                0: {side: 'bottom'}            }            }      };    var chart = new google.charts.scatter(document.getelementbyid('scatter_top_x'));    chart.draw(data, google.charts.scatter.convertoptions(options));  }
<script type="text/javascript" src="https://www.google.com/jsapi"></script>  <div id="scatter_top_x"></div>


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -