This is a migrated thread and some comments may be shown as answers.

Binding form to array generated from form values calculations

1 Answer 77 Views
Charts
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 20 Feb 2013, 09:00 PM
i need to generated a simple line chart using an array generated from form value calculations. What is the best way to accomplish this.  I tried the bind to local data, but I don't know how to update the local data based on the array calculations.
PHP array
Array
(
    [0] => Array
        (
            [name] => 0.1
            [value] => 422.19
        )

    [1] => Array
        (
            [name] => 0.2
            [value] => 256.77
        )

    [2] => Array
        (
            [name] => 0.4
            [value] => 143.96
        )...
bound local data
                var windowSizeMbs = [
                    {
                        "country": "United States",
                        "rtt": "0.1mS",
                        "value": 108.81
                    },
                    {
                        "country": "United States",
                        "rttms": "0.2mS",
                        "value": 100.47
                    },
                    {
                        "country": "United States",
                        "rttms": "0.4mS",
                        "value": 87.11
                    },.....

1 Answer, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 21 Feb 2013, 02:25 PM
I got it. To easy

                var windowSizeMbs = [
                    {
                        "charttype": "Throughput vs. RTT",
                        "rtt": "0.1mS",
                        "value": <?php echo $chartArea[0][value]; ?>
                    },
                    {
                        "charttype": "Throughput vs. RTT",
                        "rttms": "0.2mS",
                        "value": <?php echo $chartArea[1][value]; ?>
                    },....

Tags
Charts
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Share this question
or