• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Google Chart - applicable and an example

Alehopper

†C++|C#|Java†
Joined
Jun 25, 2011
Messages
325
Reaction score
17
Location
Poland
attachment.php

Google Chart -
applicable and an example



Hello.
At the beginning I would say that English is alien to me, and that this post will support this as I know, and online translator. Course in advance for all the mistakes I'm sorry, and I hope that this does not prevent in the reading.

At the beginning I would say that this presentation will be more than functional script. But taking inspiration from on it allowed to create many beautiful things. Thanks Google (or rather their technology), we can create pretty nice graphs that can represent different data on our server.

attachment.php


To create a diagram, you must define it in javaScript of a given model (I mean the API). The language is fairly simple, and you do not need to have the concept at all to create such a chart. Here the sample code from google:
PHP:
<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
    
      // Load the Visualization API and the piechart package.
      google.load('visualization', '1', {'packages':['corechart']});
      
      // Set a callback to run when the Google Visualization API is loaded.
      google.setOnLoadCallback(drawChart);
      
      // Callback that creates and populates a data table, 
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart() {

      // Create our data table.
      var data = new google.visualization.DataTable();
      data.addColumn('string', 'Topping');
      data.addColumn('number', 'Slices');
      data.addRows([
        ['Mushrooms', 3],
        ['Onions', 1],
        ['Olives', 1], 
        ['Zucchini', 1],
        ['Pepperoni', 2]
      ]);

      // Instantiate and draw our chart, passing in some options.
      var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
      chart.draw(data, {width: 400, height: 240});
    }
    </script>
  </head>

  <body>
    <!--Div that will hold the pie chart-->
    <div id="chart_div"></div>
  </body>
</html>
This allows you to create graphs to show statistics for your server players profesjii etc. But that is in their own use.
Regards, Alehopper~~
 
Last edited:
Back
Top