javascript - change properties of google chart -
hellp every body in code have google chart here photograph
the problem when click on line there strange dot on how disable property
and how creat thiner line ?
google.charts.load('current', {'packages':['line', 'corechart']}); google.charts.setonloadcallback(drawchart); function drawchart() { var button = document.getelementbyid('change-chart'); var chartdiv = document.getelementbyid('dealchart_div'); var data = new google.visualization.datatable(); data.addcolumn('number', 'x'); data.addcolumn('number', ""); data.addcolumn('number', ""); data.addcolumn('number', ""); // data.addcolumn({type:'number', role:'interval'}); // data.addcolumn({type:'number', role:'interval'}); // interval role col. // data.addcolumn({type:'boolean', role:'scope'}); // interval role col. //data.addcolumn({type:'boolean', role:'scope'}); // interval role col. // data.addcolumn('number', "average hours of daylight"); data.addrows([ [ 3.47072 ,32853.30048,null,null ], [ 3.47424 ,30506.63616,null,null ], [ 3.47776 ,28159.97184,null,null ], [ 3.48128 ,25813.30752,null,null ], [ 3.4848 ,23466.6432,null,null ], [ 3.48832 ,21119.97888,null,null ], [ 3.49184 ,18773.31456,null,null ], [ 3.49536 ,16426.65024,null,null ], [ 3.49888 ,14079.98592,null,null ], [ 3.5024 ,11733.3216,null,null ], [ 3.50592 ,9386.6572799999,null,null ], [ 3.50944 ,7039.9929599999,null,null ], [ 3.51296 ,4693.32864,null,null ], [ 3.51648 ,2346.66432,null,null ], [ 3.51999 ,null,null,175999.824 ], [ 3.52 ,null,null,-175999.824 ], [ 3.52352 ,null,-2346.66432,null ], [ 3.52704 ,null,-4693.32864,null ], [ 3.53056 ,null,-7039.9929599999,null ], [ 3.53408 ,null,-9386.6572799999,null ], [ 3.5376 ,null,-11733.3216,null ], [ 3.54112 ,null,-14079.98592,null ], [ 3.54464 ,null,-16426.65024,null ], [ 3.54816 ,null,-18773.31456,null ], [ 3.55168 ,null,-21119.97888,null ], [ 3.5552 ,null,-23466.6432,null ], [ 3.55872 ,null,-25813.30752,null ], [ 3.56224 ,null,-28159.97184,null ], [ 3.56576 ,null,-30506.63616,null ], [ 3.56928 ,null,-32853.30048,null ], [ 3.5728 ,null,-35199.9648,null ], [ 3.57632 ,null,-37546.62912,null ], [ 3.57984 ,null,-39893.29344,null ], [ 3.58336 ,null,-42239.95776,null ], [ 3.58688 ,null,-44586.62208,null ], [ 3.5904 ,null,-46933.2864,null ], [ 3.59392 ,null,-49279.950720001,null ], [ 3.59744 ,null,-51626.615040001,null ] // [ $newx , $payyer], // [new date(2014, 1), .4, 8.7], //[new date(2014, 11), -.2, 4.5] ]); var classicoptions = { title: 'your exposed deal', width: 430, height: 360, // gives each series axis matches vaxes number below. series: { 0: {axis: '', }, interval: { 'interval': { 'color': '#000000', 'style':'bars', 'barwidth':0, 'linewidth':4, 'pointsize':1, 'fillopacity':1 }, // 'interval': { 'color': '#000000', 'style':'bars', 'barwidth':0, 'linewidth':4, 'pointsize':1, 'fillopacity':1 }, } }, colors: [ 'green','red','black'], vaxes: { // adds titles each axis. 0: {title: 'profit'}, }, haxis: { title: 'rate', legend: 'none' }, vaxis: { viewwindow: { } } }; function drawmaterialchart() { var materialchart = new google.charts.line(chartdiv); materialchart.draw(data, materialoptions); } function drawclassicchart() { var classicchart = new google.visualization.linechart(chartdiv); classicchart.draw(data, classicoptions); } drawclassicchart(); }
a 'style'
column role can used make point size 0
,
, line thinner
see following working snippet,
data view used add columns 'style'
role...
google.charts.load('current', { callback: drawchart, packages: ['corechart'] }); function drawchart() { var button = document.getelementbyid('change-chart'); var chartdiv = document.getelementbyid('chart_div'); var data = new google.visualization.datatable(); data.addcolumn('number', 'x'); data.addcolumn('number', ""); data.addcolumn('number', ""); data.addcolumn('number', ""); data.addrows([ [ 3.47072 ,32853.30048,null,null ], [ 3.47424 ,30506.63616,null,null ], [ 3.47776 ,28159.97184,null,null ], [ 3.48128 ,25813.30752,null,null ], [ 3.4848 ,23466.6432,null,null ], [ 3.48832 ,21119.97888,null,null ], [ 3.49184 ,18773.31456,null,null ], [ 3.49536 ,16426.65024,null,null ], [ 3.49888 ,14079.98592,null,null ], [ 3.5024 ,11733.3216,null,null ], [ 3.50592 ,9386.6572799999,null,null ], [ 3.50944 ,7039.9929599999,null,null ], [ 3.51296 ,4693.32864,null,null ], [ 3.51648 ,2346.66432,null,null ], [ 3.51999 ,null,null,175999.824 ], [ 3.52 ,null,null,-175999.824 ], [ 3.52352 ,null,-2346.66432,null ], [ 3.52704 ,null,-4693.32864,null ], [ 3.53056 ,null,-7039.9929599999,null ], [ 3.53408 ,null,-9386.6572799999,null ], [ 3.5376 ,null,-11733.3216,null ], [ 3.54112 ,null,-14079.98592,null ], [ 3.54464 ,null,-16426.65024,null ], [ 3.54816 ,null,-18773.31456,null ], [ 3.55168 ,null,-21119.97888,null ], [ 3.5552 ,null,-23466.6432,null ], [ 3.55872 ,null,-25813.30752,null ], [ 3.56224 ,null,-28159.97184,null ], [ 3.56576 ,null,-30506.63616,null ], [ 3.56928 ,null,-32853.30048,null ], [ 3.5728 ,null,-35199.9648,null ], [ 3.57632 ,null,-37546.62912,null ], [ 3.57984 ,null,-39893.29344,null ], [ 3.58336 ,null,-42239.95776,null ], [ 3.58688 ,null,-44586.62208,null ], [ 3.5904 ,null,-46933.2864,null ], [ 3.59392 ,null,-49279.950720001,null ], [ 3.59744 ,null,-51626.615040001,null ] ]); var view = new google.visualization.dataview(data); view.setcolumns([0, 1, { calc: function (dt, row) { return 'line {stroke-width: 1; stroke-color: green;}, point {size: 0;}'; }, type: 'string', role:'style' }, 2, { calc: function (dt, row) { return 'line {stroke-width: 1; stroke-color: red;}, point {size: 0;}'; }, type: 'string', role:'style' }, 3, { calc: function (dt, row) { return 'line {stroke-width: 1; stroke-color: black;}, point {size: 0;}'; }, type: 'string', role:'style' }]); var classicoptions = { title: 'your exposed deal', width: 430, height: 360, colors: [ 'green','red','black'], vaxes: { 0: {title: 'profit'}, }, haxis: { title: 'rate', legend: 'none' }, pointsize: 0 }; function drawclassicchart() { var classicchart = new google.visualization.linechart(chartdiv); google.visualization.events.addlistener(classicchart, 'select', function () { classicchart.setselection([]); }); classicchart.draw(view, classicoptions); } drawclassicchart(); }
<script src="https://www.gstatic.com/charts/loader.js"></script> <div id="chart_div"></div>
Comments
Post a Comment