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 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?