douzhoulei8959 2013-12-05 12:45
浏览 40
已采纳

Highchart没有在cakephp中显示

I'm working on one of the cakephp website, Where i'm using HighchartPHP libraries. But high-chart is not displaying. This issue is only when i use dynamic data from database, but if i use static array to pass then it will working fine with same code.

Below are array which i get from dynamic code i have used:

stdClass Object
(
    [series] => Array
        (
            [0] => Array
                (
                    [name] => Forwarding Facility 1
                    [data] => Array
                        (
                            [0] => 28.5
                            [1] => 410.68
                            [2] => 0
                            [3] => 0
                        )

                )

            [1] => Array
                (
                    [name] => Forwarding Facility 2
                    [data] => Array
                        (
                            [0] => 0
                            [1] => 0
                            [2] => 99.05000000000001
                            [3] => 0
                        )

                )

            [2] => Array
                (
                    [name] => Forwarding Facility 3
                    [data] => Array
                        (
                            [0] => 0
                            [1] => 15.7
                            [2] => 0
                            [3] => 0
                        )

                )

            [3] => Array
                (
                    [name] => Hampshire Turf
                    [data] => Array
                        (
                            [0] => 0
                            [1] => 540
                            [2] => 0
                            [3] => 0
                        )

                )

        )

)

Below are static data array i used from one of the example from demo :

    stdClass Object
(
    [series] => Array
        (
            [0] => Array
                (
                    [name] => John
                    [data] => Array
                        (
                            [0] => 5
                            [1] => 3
                            [2] => 4
                            [3] => 7
                            [4] => 2
                        )

                )

            [1] => Array
                (
                    [name] => Jane
                    [data] => Array
                        (
                            [0] => 2
                            [1] => 2
                            [2] => 3
                            [3] => 2
                            [4] => 1
                        )

                )

            [2] => Array
                (
                    [name] => Joe
                    [data] => Array
                        (
                            [0] => 3
                            [1] => 4
                            [2] => 4
                            [3] => 2
                            [4] => 5
                        )

                )

        )

)

I have already spent 2 days to solve it, but i cant find any solution for the same.

Can anybody help me out? This will very appreciate!

Thanks, Chandresh

  • 写回答

2条回答 默认 最新

  • dongyi4170 2013-12-18 05:42
    关注

    I have tried with lots of different ways, but found very simple solution. CASTING. Yes, somehow its required to TYPE CASTE array value when passing to the highcharts. so i use floatval() function to convert data into the float value. and finally its working like a charm!

    Thank you all for your response and support!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?