SGR Generate Pie-EN : Différence entre versions

De BlueWiki
(Exemple de code)
(Sample Code)
Ligne 74 : Ligne 74 :
 
For this graph you will need to use the code below
 
For this graph you will need to use the code below
  
   // Nom utilisateur (OS) : Paul Kuhn - BlueCompany
+
   // User (OS) : Paul Kuhn - BlueCompany
 
   // ----------------------------------------------------
 
   // ----------------------------------------------------
   // Méthode : Exemple_Camembert
+
   // Method : Pie_Sample
 +
 
 +
  // Definition of generic parameters of the graph
 +
ARRAY TEXT($DataGrapheName;0)
 +
ARRAY TEXT($DataGraphe;0)
 +
APPEND TO ARRAY($DataGrapheName;"Title")
 +
APPEND TO ARRAY($DataGraphe;"Revenue by state")  // title (not shown if empty)
 +
APPEND TO ARRAY($DataGrapheName;"GraphBGColor")
 +
APPEND TO ARRAY($DataGraphe;"White")  // BackGround color
 +
APPEND TO ARRAY($DataGrapheName;"GraphFont")
 +
APPEND TO ARRAY($DataGraphe;"times")  // Font
 +
APPEND TO ARRAY($DataGrapheName;"ShowLegend")  // Echelles des valeurs
 +
APPEND TO ARRAY($DataGraphe;"true")  // vrai/faux ou true/false
 +
APPEND TO ARRAY($DataGrapheName;"TitleAlignement")  // Title alignment
 +
APPEND TO ARRAY($DataGraphe;String(Center))
 
   
 
   
  // Définition des paramètres de dessin génériques du graphe
+
  ARRAY TEXT(Legende;6)
  TABLEAU TEXTE($DataGrapheName;0)
+
  Legende{1}:="California"
  TABLEAU TEXTE($DataGraphe;0)
+
  Legende{2}:="Texas"
  AJOUTER A TABLEAU($DataGrapheName;"Title")
+
  Legende{3}:="Florida"
  AJOUTER A TABLEAU($DataGraphe;"Répartition du CA par région") // 1 - titre du graphe
+
  Legende{4}:="South carolina"
 +
Legende{5}:="Michigan"
 +
Legende{6}:="Others"
 
   
 
   
  AJOUTER A TABLEAU($DataGrapheName;"GraphBGColor")
+
  ARRAY REAL(ValueC;6)
  AJOUTER A TABLEAU($DataGraphe;"White"// 2 - couleur du fond
+
  For ($i;1;6)
 +
ValueC{$i}:=(Random%(101))
 +
  End for
 
   
 
   
  AJOUTER A TABLEAU($DataGrapheName;"GraphFont")
+
  ARRAY TEXT(color;6)
AJOUTER A TABLEAU($DataGraphe;"times")  // 3 - Police du graphe
+
  color{1}:="lightsteelblue"
+
  color{2}:="pink"
AJOUTER A TABLEAU($DataGrapheName;"ShowLegend")  // Echelles des valeurs
+
  color{3}:="chocolate"
AJOUTER A TABLEAU($DataGraphe;"true")  // vrai/faux ou true/false
+
  color{4}:="darksalmon"
+
  color{5}:="red"
AJOUTER A TABLEAU($DataGrapheName;"TitleAlignement")  // Titre du graphe (ne s'affiche pas si vide)
+
  color{6}:="green"
AJOUTER A TABLEAU($DataGraphe;Chaine(Centré))
+
  TheGraphe:=SGR_Generate_Pie (->$DataGrapheName;->$DataGraphe;->Legende;->ValueC;->color)
+
TABLEAU TEXTE(Legende;6)
+
  Legende{1}:="Ile de France"
+
Legende{2}:="Provence - Cote d'azur"
+
Legende{3}:="Rhône-alpe"
+
Legende{4}:="Bretagne"
+
Legende{5}:="Nord"
+
Legende{6}:="Autres"
+
+
TABLEAU REEL(ValueC;6)
+
Boucle ($i;1;6)
+
ValueC{$i}:=(Hasard%(101))
+
Fin de boucle
+
+
TABLEAU TEXTE(couleur;6)
+
couleur{1}:="lightsteelblue"
+
  couleur{2}:="pink"
+
  couleur{3}:="chocolate"
+
  couleur{4}:="darksalmon"
+
  couleur{5}:="red"
+
  couleur{6}:="green"
+
+
  TheGraphe:=SGR_Generate_Pie (->$DataGrapheName;->$DataGraphe;->Legende;->ValueC;->couleur)
+

Version du 8 décembre 2013 à 02:26

Parameters


Parameter Type Parameter # Description
Name of Graph's parameters Pointer caption 1 Pointer to a text array that contains the name of the parameters, this array must have the same size as the array of parameter values ​​of the graph

Possible values ​​of the parameter of the graph are the following:

  1. - "Titre" or "Title" : graph title
  2. - "Couleur de fond du graphe" or "GraphBGColor" : Background color of the graph
  3. - "Police du graphe" or "GraphFont" : Font legends and scales
  4. - "alignement du titre" or "TitleAlignement" : Title Alignment 0,1,2,3
  5. - "Affichage de la légende" or "ShowLegend" : Display the legend "yes" or "no"
Parameter values ​​of the graph Pointer caption 2 Pointer to the array of parameter values this array must be the same size as the previous
Part names Pointer caption 3 Pointer to an array (type: text) of the names of portions of pie chart
Values Pointer caption 4 Pointer to an array (type: real) of part values ​of pie chart
Coulors Pointer caption 5 Pointer to an array (type: text) of colors of portions of pie chart
Graph Picture caption Picture including the SVG code

Description


This graph will be completely reviewed in the next version

The next version will allow you to detach an area and give perspective and depth to the graph

Sample Code


caption

For this graph you will need to use the code below

 // User (OS) : Paul Kuhn - BlueCompany
 // ----------------------------------------------------
 // Method : Pie_Sample
 // Definition of generic parameters of the graph
ARRAY TEXT($DataGrapheName;0)
ARRAY TEXT($DataGraphe;0)
APPEND TO ARRAY($DataGrapheName;"Title")
APPEND TO ARRAY($DataGraphe;"Revenue by state")  // title (not shown if empty)
APPEND TO ARRAY($DataGrapheName;"GraphBGColor")
APPEND TO ARRAY($DataGraphe;"White")  // BackGround color
APPEND TO ARRAY($DataGrapheName;"GraphFont")
APPEND TO ARRAY($DataGraphe;"times")  // Font
APPEND TO ARRAY($DataGrapheName;"ShowLegend")  // Echelles des valeurs
APPEND TO ARRAY($DataGraphe;"true")  // vrai/faux ou true/false
APPEND TO ARRAY($DataGrapheName;"TitleAlignement")  // Title alignment
APPEND TO ARRAY($DataGraphe;String(Center))

ARRAY TEXT(Legende;6)
Legende{1}:="California"
Legende{2}:="Texas"
Legende{3}:="Florida"
Legende{4}:="South carolina"
Legende{5}:="Michigan"
Legende{6}:="Others"

ARRAY REAL(ValueC;6)
For ($i;1;6)
ValueC{$i}:=(Random%(101))
End for 

ARRAY TEXT(color;6)
color{1}:="lightsteelblue"
color{2}:="pink"
color{3}:="chocolate"
color{4}:="darksalmon"
color{5}:="red"
color{6}:="green"
TheGraphe:=SGR_Generate_Pie (->$DataGrapheName;->$DataGraphe;->Legende;->ValueC;->color)