# An SVG Bar chart demonstrating PHP integration

This is a demonstration of integrating your PHP server-based code with RGraph. As demonstrated here you can use the `json_encode()` PHP function to convert your PHP arrays or objects into a string that you can print along with the rest of your page. You can then use the resulting JavaScript data structure to pass the information to RGraph.

This is the JSON that is being printed by PHP on to the page:

    [{"value":6,"label":"Jan","labelsAbove":""},{"value":3,"label":"Feb","labelsAbove":""},{"value":8,"label":"Mar","labelsAbove":""},{"value":9,"label":"Apr","labelsAbove":"Highest"},{"value":4,"label":"May","labelsAbove":""},{"value":5,"label":"Jun","labelsAbove":""},{"value":6,"label":"Jul","labelsAbove":""},{"value":4,"label":"Aug","labelsAbove":""},{"value":3,"label":"Sep","labelsAbove":""},{"value":1,"label":"Oct","labelsAbove":"Lowest"},{"value":5,"label":"Nov","labelsAbove":""},{"value":6,"label":"Dec","labelsAbove":""}]

This goes in the documents header:

    <script src="RGraph.svg.common.core.js"></script>
    <script src="RGraph.svg.bar.js"></script>

Put this where you want the chart to show up:

    <div style="width: 550px; height: 300px" id="chart-container"></div>

This is the code that generates the chart - it should be placed AFTER the `<div>` tag: