I am having trouble transmitting SQL data in my view. I verified the information I received from my model I do not know JSON very well but I am trying to learn My goal is to populate a chart with two fields which are only numbers in this high JavaScript JavaScript Please help, thank you!
Controller
Function Dashboard () {// Ticket in queue> $ query = $ this-> mhedash_model- & gt; Maint_pending_tickets (); $ Result3 = $ query- & gt; Result_are (); $ This- & gt; Table- & gt; Set_heading ('work number', 'vehicle number', 'date deposit', 'submit time'); $ Data ['table'] ['line in vehicle'] = $ this- & gt; Table- & gt; Generate_table ($ result3); // active ticket $ query = $ this- & gt; Mhedash_model-> Select select_active (); $ Result = $ query- & gt; Result_are (); $ This- & gt; Table- & gt; Set_heading ('service number', 'start date', 'mechanic', 'vehicle number', 'description', 'type'); $ Data ['table'] ['vehicle is being actively working'] = $ this- & gt; Table- & gt; Generated_table ($ result); // Waiting on Part $ query = $ this-> mhedash_model- & gt; Select_pending_parts (); $ Result2 = $ query- & gt; Result_are (); $ This- & gt; Table- & gt; Set_heading ('service number', 'start date', 'mechanic', 'vehicle number', 'description', 'type'); $ Data ['table'] ['wait for parts'] = $ this- & gt; Table- & gt; Generated_table ($ result2); // graph - component higher $ query = $ this- & gt; Mhedash_model-> Graph_available_ar (); $ Result4 = $ query- & gt; Result_are (); $ Data ['row'] [']] = $ this- & gt; Table- & gt; Generated_table ($ result4); $ Query = $ this- & gt; Mhedash_model-> Graph_available_dt (); $ Result5 = $ query- & gt; Result_are (); $ Data ['row'] [']] = $ this- & gt; Table- & gt; Generated_table ($ 5 result); $ Series_data [] = array ('name' = & gt; 'available', 'data' = & gt; (int) $ result4); $ Series_data [] = array ('name' = & gt; 'no_available', 'data' = & gt; (int) $ result 5); $ This- & gt; View_data ['chain_data'] = json_encode ($ series_data, JSON_NUMERIC_CHECK); // Load data $ data ['page_title'] = 'MHE dashboard'; $ Data ['main_content'] = 'mhe / mhe_dashboard_view'; $ Data ['array'] = $ result; $ Data ['array2'] = $ result 2; $ Data ['array3'] = $ result3; Print json_encode ($ series_data); // resonance json_encode ($ series_data, JSON_NUMERIC_CHECK); $ $ - this- & gt; Load-> View ('/ template', $ data included) Return; }
Check that there is highchair javascript in it
var chart; High values ({chart: {type: 'column'}, xxis: {categories: ['one', 'two']}, plot options: {series: {allowPointSelect: true}}, series: [[data: & Lt ;? php included in the echo ($ series_data, ',')? & Gt;]}]}}; // button action $ ('# button') .function () {var chart = $ ('# container '). High Chart (), Selected Points = Chart.Getastic Points (); If (chart.lib) {chart.lbl.destroy ();} chart.lbl = chart.renderer .label (' You chose '+ Selected Points Lamp + 'digit', 100, 60) .attr ({padding: 10, r: 5, fill: Highcharts.getOptions). [1], zIndex: 5}) .css ({color: 'white'} ) .add ();});}); & Lt; / Script & gt;
In addition, when I use son_encode for my $ series_data
[{"name": "available", "data": 1) Print it, then it prints}, {"Name": "not_available", "data": 1}]
No comments:
Post a Comment