Open Menu dzosoft
Close Menu dzosoft

   TOUT SUR L'INFORMATIQUE ET LA TECHNOLOGIE


                             




Release your testosterone and observe the extreme increase in muscle mass.

Publish perfectly-optimized content in 1-click



 
 
 

How to easily create charts using PHP used in particular by companies such as NASA, Sony or Airbus

 


 
How to easily create charts using PHP  used in particular by companies such as NASA, Sony or Airbus
 
How to create a chart in PHP and in a simple way? All you have to do is use the dedicated library to create graphics in PHP.
What amazed me with pChart is its simplicity of use, absolutely incredible, but the possibilities it opens up.
For example, I have used pChart in automated pages, these are created from a database by retrieving variables.

 

CREATE A CHART WITH PCHART

 
 

First download the various classes used in this example from


pChart2.1.4.zip 

<?php

/* I load the pChart libraries which is in the class folder so that it can display a graph*/ include("class/pData.class.php"); include("class/pDraw.class.php"); include("class/pImage.class.php"); include("class/pPie.class.php"); include("class/pIndicator.class.php");
/*I create a new object containing my data for the chart */ $myData = new pData();
/*I lay out my data series to use for the chart and I set the vertical axis title with set Axis Name*/ $myData->addPoints(array(500,400,200,55,450,360,200,10,75,550,150),"Probe 3"); $myData->setSerieWeight("Probe 3",2); $myData->setAxisName(0,"Number of males");
/*I indicate the horizontal data of the graph. There must be the same number as for my previous data series (logic)*/ $myData->addPoints(array("2013","2014","2015","2016","2017","2018","2019","2020","2021","2022","2023"),"Labels"); $myData->setSerieDescription("Labels","Years"); $myData->setAbscissa("Labels"); $myData->setPalette("Probe 3",array("R"=>0,"G"=>0,"B"=>255));
/* I create the image that will contain my previously created graphic */ $myPicture = new pImage(600,300,$myData);
/*I create a border in my image */ $myPicture->drawRectangle(2,2,599,299,array("R"=>0,"G"=>0,"B"=>255));
/* I indicate the title of my graphic, its positioning on the image and its font */ $myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>11)); $myPicture->drawText(200,25,"Evolution of the number of male births in my little village",array("FontSize"=>14,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
/* I choose the background of my graph */ $myPicture->setFontProperties(array("FontName"=>"fonts/pf_arma_five.ttf","FontSize"=>6));
/* I determine the size of the graphic and its location in the image */ $myPicture->setGraphArea(60,40,550,280);
/* Parameters to draw the graph from the two abscissas */ $scaleSettings = array("XMargin"=>10,"YMargin"=>10,"Floating"=>TRUE,"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE); $myPicture->drawScale($scaleSettings);
/* I insert on the right side the name of the author and the rights */
/* I draw my graph according to the previous parameters*/
/* I add red dots (plots) by displaying over the data */
/* I indicate the path where I want my image to be created */ $myPicture->autoOutput("images/evolution-male-births.png");
?>


Here are several examples to show you results that can be created with pChart: Examples



This library is available on www.pchart.net , it is used in particular by companies such as NASA, Sony or Airbus

También te puede interesar


Les 5 meilleurs tutoriels pour apprendre le php en 2023

Comment créer une application de chat avec PHP et HTML en quelques étapes seulement

Comment installer XAMPP (avec Apache, MySQL et phpMyAdmin) sur Windows

Comment envoyer facilement un email avec PHPMailer en PHP

Comment se connecter avec Authentification OTP en PHP

Comment utiliser ChatGPT avec PHP


Leave comment
          

Enregistrez le pseudo et l'e-mail dans ce navigateur pour la prochaine fois.



Cargando...     

NICOTINE FREE