Line ChartNEW
1.7.27 Default theme
Simply create charts and linegraph
HIDE CODE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | <style> canvas{ height: 600px!important; } </style> <?php // Bar Chart Example - First Instance $xcrud1 = Xcrud::get_instance(); $xcrud1 ->table( 'orderdetails' ); $xcrud1 ->chart_labels( [ 'S24_2841' , 'S24_3420' , 'S24_3949' , 'S24_4278' , 'S32_4289' , 'S50_1341' ], // Labels [ // Multiple datasets (even if there's just one) [ 'label' => '# of Quantity Ordered' , // Dataset label 'data' => '#select quantityOrdered from orderdetails where id IN (60,61,62,63,64,65)' , // Data points 'backgroundColor' => 'rgba(255, 99, 132, 0.2)' , // Bar background color 'borderColor' => 'rgba(255, 99, 132, 1)' , // Bar border color 'borderWidth' => 1, // Border width 'pointStyle' => 'circle' , 'pointRadius' => 10, 'pointHoverRadius' => 15 ], [ 'label' => '# Price of Order' , // Dataset label 'data' => '#select priceEach from orderdetails where id IN (60,61,62,63,64,65)' , // Data points 'backgroundColor' => 'rgba(30, 23, 132, 0.2)' , // Bar background color 'borderColor' => 'rgba(30, 23, 132, 0.2)' , // Bar border color 'borderWidth' => 1, // Border width 'pointStyle' => 'circle' , 'pointRadius' => 10, 'pointHoverRadius' => 15 ] ], 'line' , // Chart type (e.g., 'bar') [ 'scales' => [ 'y' => [ 'beginAtZero' => true] // Custom scale options ], 'plugins' => [ 'legend' => [ 'display' => true], // Custom plugin options (e.g., legend display) 'title' => [ 'display' => true, 'text' => 'Point Style: ctx.chart.data.datasets[0].pointStyle' , ] ] ] // Custom options (e.g., scale settings, legend display) ); $xcrud1 ->chart_view(true); $xcrud1 ->unset_add(); $xcrud1 ->unset_edit(); $xcrud1 ->unset_remove(); $xcrud1 ->unset_view(); $xcrud1 ->unset_csv(); $xcrud1 ->unset_limitlist(); $xcrud1 ->unset_numbers(); $xcrud1 ->unset_pagination(); $xcrud1 ->unset_print(); $xcrud1 ->unset_search(); $xcrud1 ->unset_title(); $xcrud1 ->unset_sortable(); echo $xcrud1 ->render(); ?> |
?>