akhibam Report post Posted December 14, 2014 (edited) Hi, before this Im working with flot.js with PHP and MYSQL.Currently im working on JSP with FusionCharts. I want to load 10 latest data(this is done in query) from MySQL and load it in FusionCharts Line Chart. Question is how to do this? Really blank right now.This is how I take data from MySQL in PHP : PHP <?php $dataGlucose = array(); $ctrGlucose = 0; while ($rowGlucose = mysql_fetch_array($resultGlucose, MYSQL_ASSOC)){ $dataGlucose[] = array( $ctrGlucose, $rowGlucose['glucose'] ); $ctrGlucose++; } ?> Javascript (Flot.js) $(function() { var d1 = <?php echo json_encode($dataSys); ?>; var d2 = <?php echo json_encode($dataDias); ?>; var stack = 0, bars = false, lines = true, steps = false; function plotWithOptions() { $.plot("#graphBlood", [ d1, d2], { series: { stack: stack, lines: { show: lines, fill: true, steps: steps }, bars: { show: bars, barWidth: 0.5 } }, colors: ["#4BB74C", "#840000"], }); } plotWithOptions(); }); Hope the pros here can help me. Thanks a lot Edited December 14, 2014 by akhibam Share this post Link to post Share on other sites
Nabajeet Report post Posted December 15, 2014 Hi, You can create a JSON array in a Java object to retrieve the data from DB and pass this JSON Object to the JSP using JSTL. Please check this drop box link for a demo sample:https://www.dropbox.com/s/p22835owx2cke6q/DB_JSP.rar?dl=0 Share this post Link to post Share on other sites