Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing yii with dynamic data and highcharts
    primarykey
    data
    text
    <p>Hi everybody thanks for reading i was wandering how you can insert dynamic data into the highcharts extension for example i have the highcharts extension as follows (location of code =>Reprting/index): </p> <pre><code>$this-&gt;Widget('ext.highcharts.HighchartsWidget', array( 'options'=&gt;array( 'credits' =&gt; array('enabled' =&gt; false), 'title' =&gt; array('text' =&gt; $graphTitle), 'xAxis' =&gt; array( 'categories' =&gt; array('Apples', 'Bananas', 'Oranges') ), 'yAxis' =&gt; array( 'title' =&gt; array('text' =&gt; 'Fruit eaten') ), 'series' =&gt; array( array('name' =&gt; 'Jane', 'data' =&gt; array(3, 6, 7)), array('name' =&gt; 'John', 'data' =&gt; array(5, 7, 3)) ) ))); </code></pre> <p>And i have the following code in the controller :</p> <pre><code>public function actionIndex() { $model= $this-&gt;loadModel(); $dataProvider=new CActiveDataProvider('Reporting'); $graphTitle= 'Price Per Product'; $this-&gt;render('index',array( 'dataProvider'=&gt;$dataProvider, 'graphTitle'=&gt;$graphTitle, 'model'=&gt;$model, )); } </code></pre> <p>And the following code is the model : </p> <pre><code>class Reporting extends CActiveRecord { public static function model($className=__CLASS__) { return parent::model($className); } /** * @return string the associated database table name */ public function tableName() { return '{{price}}'; } /** * @return array validation rules for model attributes. */ public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( array('id_product, id_channel', 'required'), array('id_product, id_channel', 'numerical', 'integerOnly'=&gt;true), array('price_min, price_max', 'numerical'), // The following rule is used by search(). // Please remove those attributes that should not be searched. array('id_price, id_product, id_channel, price_min, price_max', 'safe', 'on'=&gt;'search'), ); } /** * @return array relational rules. */ public function relations() { // NOTE: you may need to adjust the relation name and the related // class name for the relations automatically generated below. return array( 'idChannel' =&gt; array(self::BELONGS_TO, 'Channel', 'id_channel'), 'idProduct' =&gt; array(self::BELONGS_TO, 'Product', 'id_product'), ); } public function attributeLabels() { return array( 'id_price' =&gt; __('Id Price'), 'id_product' =&gt; __('Id Product'), 'id_channel' =&gt; __('Id Channel'), 'price_min' =&gt; __('Price Min'), 'price_max' =&gt; __('Price Max'), ); } public function search() { $criteria=new CDbCriteria; $criteria-&gt;compare('id_price',$this-&gt;id_price); $criteria-&gt;compare('id_product',$this-&gt;id_product); $criteria-&gt;compare('id_channel',$this-&gt;id_channel); $criteria-&gt;compare('price_min',$this-&gt;price_min); $criteria-&gt;compare('price_max',$this-&gt;price_max); return new CActiveDataProvider($this, array( 'criteria'=&gt;$criteria, )); } } </code></pre> <p>How do i put this all together to achieve a dynamically driven graph</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload