Forum Replies Created by Sunil Urs

Viewing 8 posts - 541 through 548 (of 548 total)
  • in reply to: onclick parameters #4238

    Thank you.. :)

    You can access all properties of dataPoint/dataSeries including label. Upon any mouse event you get dataSeries and dataPoint inside the parameter e – which is passed to the event handler function. Once you have the handle to dataPoint, you can access all the properties inside dataPoint

    ex: e.dataPoint.label

    Checkout the documentation below

    https://canvasjs.com/docs/charts/basics-of-creating-html5-chart/event-handling/

    in reply to: Data Format string #4112

    Thank you… We are glad that you liked the library… :)

    in reply to: Data Format string #4110

    Sorry, as of now its not possible to change decimal separator… But we have plans to implement the same in the upcoming version…

    in reply to: How can I use PHP MySQL Dynamic data #4050

    Naavin,

    CanvasJS requires a minimum of IE9. Older versions are not supported.

    Update : IE8- is supported in v1.3 and above.

    Sunil Urs,
    Team CanvasJS

    • This reply was modified 10 years, 3 months ago by Sunil Urs.
    in reply to: empty dataPoints causes error #3760

    Rampion,

    The issue has been fixed. Please download the latest code from the download page.

    Sunil Urs,
    Team CanvasJS

    in reply to: empty dataPoints causes error #3756

    Hi Rampion,

    Thanks for reporting.. Will look into the issue and get back.

    Sunil Urs,
    Team CanvasJS

    in reply to: How can I use PHP MySQL Dynamic data #3669

    Naveen,

    Here is how you can display MySQL data in CanvasJS,

    1. Create a PHP service that returns data in JSON format.
    2. HTML page that does AJAX request to the server and fetches the data. After getting the data, it renders a Chart.

    Below is the sample code

     

    1. PHP Service to return JSON Data

    <?php
    
    header('Content-Type: application/json');
    
    $con = mysqli_connect("127.0.0.1","user","password","canvasjssampledb");
    
    // Check connection
    if (mysqli_connect_errno($con))
    {
        echo "Failed to connect to DataBase: " . mysqli_connect_error();
    }else
    {
        $data_points = array();
        
        $result = mysqli_query($con, "SELECT * FROM sales");
        
        while($row = mysqli_fetch_array($result))
        {        
            $point = array("label" => $row['product'] , "y" => $row['total_sales']);
            
            array_push($data_points, $point);        
        }
        
        echo json_encode($data_points, JSON_NUMERIC_CHECK);
    }
    mysqli_close($con);
    
    ?>

    2. HTML Page to Fetch Data and render Chart

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title></title>
        <script src="jquery.js"></script>
        <script src="canvasjs.js"></script>
    
        <script type="text/javascript">
            $(document).ready(function () {
    
                $.getJSON("data.php", function (result) {
    
                    var chart = new CanvasJS.Chart("chartContainer", {
                        data: [
                            {
                                dataPoints: result
                            }
                        ]
                    });
    
                    chart.render();
                });
            });
        </script>
    </head>
    <body>
    
        <div id="chartContainer" style="width: 800px; height: 380px;"></div>
    
    </body>
    </html>
    
    in reply to: How can I use PHP MySQL Dynamic data #3668

    Hi Naveen,

    Thanks for your interest in CanvasJS. We’ll get back to you with and example in some time…

    Sunil Urs,
    Team CanvasJS

Viewing 8 posts - 541 through 548 (of 548 total)