高清和PHP

时间:2012-08-03 18:43:39

标签: php jquery highcharts

嗨,大家好我试图将值从我的php传递给高图数据集但是它不需要帮助。

<?php $count2=$decode[nextPage][totalResults];
    echo("<input type=hidden name=aaqib value=".$count.">");
?>

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Highcharts Example</title>

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script type="text/javascript">
            $(function () {
                var chart;
                var j= $("input[name=aaqib]").val();
                var k=100;

                $(document).ready(function() {
                    chart = new Highcharts.Chart({

                        chart: {
                            renderTo: 'container'
                        },

                        title: {
                            text: 'Logarithmic axis demo'
                        },

                        xAxis: {
                            tickInterval: 1
                        },

                        yAxis: {
                            type: 'logarithmic',
                            minorTickInterval: 0.1
                        },

                        tooltip: {
                            headerFormat: '<b>{series.name}</b><br />',
                            pointFormat: 'x = {point.x}, y = {point.y}'
                        },

                        series: [{
                            data: [j,k,
                            pointStart: 1
                        }]
                    });
                });

            });
        </script>
    </head>
    <body>
        <script src="../../js/highcharts.js"></script>
        <script src="../../js/modules/exporting.js"></script>

        <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>

    </body>
</html>

嗨,大家好我试图将值从我的php传递给高图数据集但是它不需要帮助。

我需要在数据中使用J和K的值,以便它们以高图显示

2 个答案:

答案 0 :(得分:3)

将您的php个变种存储到js个变种中,然后传递给highcharts

修正以下内容。
echo('<input type="hidden" name="aaqib" value="{$count}"/>');

根据this评论进行更新。

series: [{
    data: [[j,k]]
}]

这个demo可以帮到你。

答案 1 :(得分:0)

为什么你回复你的doctype声明上面的input?我认为这属于你的身体。你还应该' - 围绕你回应的属性值。像这样的东西:

<?php $count2=$decode[nextPage][totalResults];
    echo("<input type='hidden' name='aaqib' value='$count'>");
?>

某些浏览器可能会对此进行正确威胁,但它实际上是无效的html