1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Mülheim an der Ruhr, Germany
    Posts
    79
    Answers
    5
    Vote Rating
    0
    blade226 is on a distinguished road

      0  

    Default Answered: column chart: json Problem

    Answered: column chart: json Problem


    Hi,
    i want to send a json-string and build a column-chart.

    I despair to build the string.

    I have following varaibles:
    Code:
    team = "Team1";
    anzahl = $team1;
    
    team = "Team2";
    anzahl = $team2;
    
    team = "Team3";
    anzahl = $team3;
    and so on......
    I want to sent this json-string from php:
    Code:
    data:[
            { 'team': 'Team1','anzahl':2400 },
            { 'team': 'Team2','anzahl':1168 },
            { 'team': 'Team3','anzahl':2391 },
            { 'team': 'Team4','anzahl':1802 },
            { 'team': 'Team5','anzahl':2156 },
            { 'team': 'Team6','anzahl':2696 }
                    ]
    How to build?

    THX!

  2. I find the solution:

    Code:
    $obj = new StdClass();
    $obj->team = 'Team1';
    $obj->anzahl = $team1;
    
    $obj2 = new StdClass();
    $obj2->team = 'Team2';
    $obj2->anzahl = $team2;
    
    $obj3 = new StdClass();
    $obj3->team = 'Team3';
    $obj3->anzahl = $team3;
    
    $obj4 = new StdClass();
    $obj4->team = 'Team4';
    $obj4->anzahl = $team4;
    
    $obj5 = new StdClass();
    $obj5->team = 'Team5';
    $obj5->anzahl = $team5;
    
    $obj6 = new StdClass();
    $obj6->team = 'Team6';
    $obj6->anzahl = $team6;
    
    $mydata = array($obj, $obj2, $obj3, $obj4, $obj5, $obj6);
    echo json_encode($mydata);

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Answers
    656
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You can use something like:

    Code:
    $return = array(
        'success' => TRUE,
        'data' => $data // array 
    );
      
    $return = json_encode($return);
    echo $return;
    Scott

  4. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Mülheim an der Ruhr, Germany
    Posts
    79
    Answers
    5
    Vote Rating
    0
    blade226 is on a distinguished road

      0  

    Default


    Hi,
    thx for reply!

    But:
    data is result which should arrive in ext

    Code:
    data:[
    { 'team': 'Team1','anzahl':2400 },
    { 'team': 'Team2','anzahl':1168 },
    { 'team': 'Team3','anzahl':2391 },
    { 'team': 'Team4','anzahl':1802 },
    { 'team': 'Team5','anzahl':2156 }, 
    { 'team': 'Team6','anzahl':2696 }
    ]
    How can i write it in $data? It shows me in string special character for example "

  5. #4
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Mülheim an der Ruhr, Germany
    Posts
    79
    Answers
    5
    Vote Rating
    0
    blade226 is on a distinguished road

      0  

    Default


    I find the solution:

    Code:
    $obj = new StdClass();
    $obj->team = 'Team1';
    $obj->anzahl = $team1;
    
    $obj2 = new StdClass();
    $obj2->team = 'Team2';
    $obj2->anzahl = $team2;
    
    $obj3 = new StdClass();
    $obj3->team = 'Team3';
    $obj3->anzahl = $team3;
    
    $obj4 = new StdClass();
    $obj4->team = 'Team4';
    $obj4->anzahl = $team4;
    
    $obj5 = new StdClass();
    $obj5->team = 'Team5';
    $obj5->anzahl = $team5;
    
    $obj6 = new StdClass();
    $obj6->team = 'Team6';
    $obj6->anzahl = $team6;
    
    $mydata = array($obj, $obj2, $obj3, $obj4, $obj5, $obj6);
    echo json_encode($mydata);

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi