Sparkline chart Add sparkline chart from database tables directly using PDO (Added in v 2.2)

Apart from plugin addition, you can using addChart function to generate pie chart/bar/line easily. You just needs to pass type of chart you want to generate and values to be passed. You can pass value as array or from database tables or write query. Below example shows how to add sparkline chart. Please note that each chart/graph library has it's own functions and parameters so you need to pass data accordingly.

  
                            $pdocrud = new PDOCrud();
                            $options_line = array("data-type"=>"line", "data-resize"=>"true", "data-height"=>"75", "data-width"=>"90%", "data-line-width"=>"1", "data-line-color"=>"#fff", "data-spot-color"=>"#fff", "data-fill-color"=>"", "data-highlight-line-color"=>"#fff", "data-spot-radius"=>"4");
                            $pdocrud->addChart("chart1","sparkline",array("val"=>93,34,34,34,533,434,213,23,23,23,23,23),"","","array",$options_line);
                            $options_bar = array("data-type"=>"bar", "data-resize"=>"true", "data-height"=>"75", "data-width"=>"90%", "data-line-width"=>"1", "data-line-color"=>"#fff", "data-spot-color"=>"#fff", "data-fill-color"=>"", "data-highlight-line-color"=>"#fff", "data-spot-radius"=>"4");
                            $pdocrud->addChart("chart2","sparkline",array("val"=>93,34,34,34,533,434,213,23,23,23,23,23),"","","array",$options_bar);
                            $options_pie = array("data-type"=>"pie", "data-resize"=>"true", "data-height"=>"75", "data-width"=>"90%", "data-line-width"=>"1", "data-line-color"=>"#fff", "data-spot-color"=>"#fff", "data-fill-color"=>"", "data-highlight-line-color"=>"#fff", "data-spot-radius"=>"4");
                            $pdocrud->addChart("chart3","sparkline", "employee", "Id", "Id as empId", "db",$options_pie);
                            $options_line = array("data-type"=>"line", "data-resize"=>"true", "data-height"=>"75", "data-width"=>"90%", "data-line-width"=>"1", "data-line-color"=>"#fff", "data-spot-color"=>"#fff", "data-fill-color"=>"", "data-highlight-line-color"=>"#fff", "data-spot-radius"=>"4");
                            $pdocrud->addChart("chart4","sparkline","SELECT Salary FROM `empsalary` ", "", "", "sql",$options_line);
                            echo $pdocrud->render("chart",array("chart1","chart2","chart3","chart4"));
                        

Deprecated: Required parameter $field follows optional parameter $op in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrud.php on line 924

Deprecated: Required parameter $task follows optional parameter $op in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrud.php on line 924

Deprecated: Required parameter $totalrecords follows optional parameter $page in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrudHelper.php on line 191