简体   繁体   English

Highchart和PHP

[英]Highchart and php

Hi guys im trying to pass value from my php to highchart dataset but its not working help needed. 嗨,大家好,我试图将价值从我的php传递到highchart数据集,但所需的帮助无效。

<?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>

Hi guys im trying to pass value from my php to highchart dataset but its not working help needed. 嗨,大家好,我试图将价值从我的php传递到highchart数据集,但所需的帮助无效。

i need to use value of J and K in data so that they are shown in highcharts 我需要在数据中使用J和K的值,以便它们在高图中显示

Store your php vars into a js vars and then pass to highcharts . 将您的php vars存储到js vars中,然后传递给highcharts

Fix the following too. 也修复以下问题。
echo('<input type="hidden" name="aaqib" value="{$count}"/>');

Update according to this comment. 根据评论进行更新。

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

Tthis demo should help you. 演示应为您提供帮助。

why are you echoing the input above your doctype declaration? 为什么要在doctype声明上方回显input I think that belongs inside your body. 我认为那属于你的身体。 And you should also '-signs around the attribute values in you echo. 并且您还应该在回显中的属性值周围加上“-”符号。 something like this: 像这样的东西:

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

Some browsers might threat this correctly, but it's actualy invalid html 一些浏览器可能会正确威胁到它,但实际上它是无效的html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM