javascript - Google Line Charts interpolateNulls: false breaks chart -
i knew answer going simpler making out be. added following if statement while loop.
<?php echo "['month', '$year1' , '$year2' , '$currentyear'],"; require('./phpconnect.php'); $statement1 = @mysqli_query($dbc, $query1); while($row = mysqli_fetch_array($statement1)){ if($row["year3"] == null ? $row["year3"] = 'null' : $row["year3"] = $row["year3"]); echo "['".$row["month"]."', ".$row["year1"].", ".$row["year2"].", ".$row["year3"]."],"; } mysqli_close($dbc); ?> as update know problem mysql spits out null , javascript requires null. thoughts on how accomplish getting mysql null int value lowercase null.
*i wondering if can me this. created line chart visual show company sales month current year , previous 2. works fine, because @ point there 0 sales remaining months of year shows steep drop off line. don't want see that, tried changing 0s nulls in database , using interpolatenulls false. when add interpolatenulls option line chart breaks , no longer displays anything. ideas?
<script type="text/javascript"> var data; var chart; google.charts.load('current', {'packages':['corechart']}); google.charts.setonloadcallback(drawchart); function drawchart(){ data = google.visualization.arraytodatatable([ <?php echo "['month', '$year1' , '$year2' , '$currentyear'],"; require('./phpconnect.php'); $statement1 = @mysqli_query($dbc, $query1); while($row = mysqli_fetch_array($statement1)){ echo "['".$row["month"]."', ".$row["year1"].", ".$row["year2"].", ".$row["year3"]."],"; } mysqli_close($dbc); ?> ]); var options = { backgroundcolor: 'transparent', title:'total sales month', width:600, height:500, interpolatenulls: false, legend: {position: 'bottom'} }; var chart = new google.visualization.linechart(document.getelementbyid('chart_div')); chart.draw(data, options); }
Comments
Post a Comment