ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Controls (window/page/report) / Controls / Chart control / Types of charts
  • Présentation
  • Caractéristiques d'un graphe de type Composite
  • Créer un graphe composite sous l'éditeur
  • Créer un graphe composite par programmation
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Présentation
Un graphe composite est un graphe affichant plusieurs types de graphes.
Cette page d'aide présente :
Remarque : un graphe composite n'est pas un graphe de type "Composite" mais c'est un graphe contenant plusieurs séries correspondant chacune à un type de graphe spécifique.
Caractéristiques d'un graphe de type Composite
Graphe composite
Dans ce graphe :
1. Graphe de type Aire
Graphe de type Aire constituant le premier graphe du graphe composite. Pour réaliser ce graphe, la première série du graphe a été définie de type Aire (sous l'éditeur, onglet "Séries") ou par programmation via la fonction grTypeSérie.
2. Graphe de type Histogramme
Graphe de type Histogramme constituant le second graphe du graphe composite.
3. Moyenne
Moyenne affichée. Dans un graphe composite, il est possible d'ajouter une courbe de tendance :
  • soit par la fonction grTypeSérie.
  • soit sous l'éditeur, en ajoutant une série de type "Courbe de tendance".
4. Légende
Les caractéristiques de la légende sont saisies dans l'onglet "Détail" de la description du champ (bouton "Edit chart legend").
5. Titre du graphe.
Les caractéristiques du titre du graphe sont saisies dans l'onglet "Détail" de la description du champ (bouton "Edit chart title"). Il est possible de définir le titre du graphe, sa position et son style.
6. Titre des axes.
Créer un graphe composite sous l'éditeur
Pour créer un graphe composite sous l'éditeur :
  1. Créez un nouveau champ de type graphe. Définissez le type de ce graphe.
  2. Dans les onglets "Général" et "Détail" de la fenêtre de description du champ Graphe, définissez les caractéristiques générales de votre graphe.
  3. Dans l'onglet "Séries" de la fenêtre de description du champ Graphe, ajoutez les séries nécessaires, avec leur source de données.
  4. Pour chaque série définie, spécifiez dans la partie basse de l'écran :
    • le type de graphe associé à la série : Courbe, Aire, Histogramme, ...
    • la couleur de la série, l'opacité, le type de points, ...
  5. Selon le type de graphe associé à la série, définissez les propriétés spécifiques à la série.
Créer un graphe composite par programmation
Pour créer un graphe composite par programmation :
  1. Créez un graphe (fonction grCrée).
  2. Paramétrez les options globales de ce graphe (fonctions grLissage, grLégende, ...).
  3. Pour chaque série :
  4. Dessinez le graphe (fonction grDessine).
Remarque : La fonction grTypeSérie permet également de définir des courbes automatiques par rapport à une série, pour afficher une moyenne ou une régression linéaire.
Exemple de code :
nCurrentYear is int = CurrentYear()
nYearN1 is int = nCurrentYear - 1
nYearN2 is int = nCurrentYear - 2
 
// Create the chart
grCreate(CHART_CompositeChart, grArea)
 
// Light border color
grColor(CHART_CompositeChart, grColorBorder, White)
 
// Displays the gridlines
grGridlines(CHART_CompositeChart, True, grXCoordinate)
 
// Labels of X-axis
FOR i = 1 TO 12
grCategoryLabel(CHART_CompositeChart, i, Left(MonthNumberInAlpha(i), 1) + ".")
END
 
// The legend will be displayed on the right
grLegend(CHART_CompositeChart, grAtRight)
// The colors must not be gradient colors
grGradient(CHART_CompositeChart, False)
 
// Series 1 : objective (area)
// - type of series
grSeriesType(CHART_CompositeChart, 1, grArea)
// - line thickness
grLineThickness(CHART_CompositeChart, 1, 2)
// - type of line
grSeriesLineType(CHART_CompositeChart, 1, LineDash)
// - opacity
grSeriesOpacity(CHART_CompositeChart, 1, 50)
// - label
grSeriesLabel(CHART_CompositeChart, 1, "TO objective")
// - color
grSeriesColor(CHART_CompositeChart, 1, HTMLToRGB("#64B5F6"))
// - add data
grAddData(CHART_CompositeChart, 1, 1, 170)
grAddData(CHART_CompositeChart, 1, 2, 240)
grAddData(CHART_CompositeChart, 1, 3, 120)
grAddData(CHART_CompositeChart, 1, 4, 100)
grAddData(CHART_CompositeChart, 1, 5, 150)
grAddData(CHART_CompositeChart, 1, 6, 180)
grAddData(CHART_CompositeChart, 1, 7, 200)
grAddData(CHART_CompositeChart, 1, 8, 270)
grAddData(CHART_CompositeChart, 1, 9, 270)
grAddData(CHART_CompositeChart, 1, 10, 205)
grAddData(CHART_CompositeChart, 1, 11, 180)
grAddData(CHART_CompositeChart, 1, 12, 190)
 
 
// Series 2 and 3 : history A and A-1 (grouped column chart)
// - type of series
grSeriesType(CHART_CompositeChart, 2, grColumn)
grSeriesType(CHART_CompositeChart, 3, grColumn)
// - label
grSeriesLabel(CHART_CompositeChart, 2, "Yearly TO " + nCurrentYear)
grSeriesLabel(CHART_CompositeChart, 3, "Yearly TO " + nYearN1)
// - color
grSeriesColor(CHART_CompositeChart, 2, HTMLToRGB("#FFF176"))
grSeriesColor(CHART_CompositeChart, 3, HTMLToRGB("#AED581"))
// - add data (series 2)
grAddData(CHART_CompositeChart, 2, 1, 110)
grAddData(CHART_CompositeChart, 2, 2, 230)
grAddData(CHART_CompositeChart, 2, 3, 80)
grAddData(CHART_CompositeChart, 2, 4, 72)
grAddData(CHART_CompositeChart, 2, 5, 50)
grAddData(CHART_CompositeChart, 2, 6, 120)
grAddData(CHART_CompositeChart, 2, 7, 170)
grAddData(CHART_CompositeChart, 2, 8, 230)
grAddData(CHART_CompositeChart, 2, 9, 125)
grAddData(CHART_CompositeChart, 2, 10, 215)
 
// - add data (series 3)
grAddData(CHART_CompositeChart, 3, 1, 150)
grAddData(CHART_CompositeChart, 3, 2, 210)
grAddData(CHART_CompositeChart, 3, 3, 50)
grAddData(CHART_CompositeChart, 3, 4, 62)
grAddData(CHART_CompositeChart, 3, 5, 40)
grAddData(CHART_CompositeChart, 3, 6, 160)
grAddData(CHART_CompositeChart, 3, 7, 180)
grAddData(CHART_CompositeChart, 3, 8, 220)
grAddData(CHART_CompositeChart, 3, 9, 230)
grAddData(CHART_CompositeChart, 3, 10, 205)
grAddData(CHART_CompositeChart, 3, 11, 150)
grAddData(CHART_CompositeChart, 3, 12, 160)
 
 
// Series 4 : deviation (column chart)
// - type of series
grSeriesType(CHART_CompositeChart, 4, grColumn)
// - label
grSeriesLabel(CHART_CompositeChart, 4, StringBuild("Deviation %1-%2", nCurrentYear, nYearN1))
// - color
grSeriesColor(CHART_CompositeChart, 4, HTMLToRGB("#E57373"))
// - add data
grAddData(CHART_CompositeChart, 4, 1, -40)
grAddData(CHART_CompositeChart, 4, 2, 20)
grAddData(CHART_CompositeChart, 4, 3, 30)
grAddData(CHART_CompositeChart, 4, 4, 10)
grAddData(CHART_CompositeChart, 4, 5, 10)
grAddData(CHART_CompositeChart, 4, 6, -40)
grAddData(CHART_CompositeChart, 4, 7, -10)
grAddData(CHART_CompositeChart, 4, 8, 10)
grAddData(CHART_CompositeChart, 4, 9, 20)
grAddData(CHART_CompositeChart, 4, 10, 10)
 
 
// Displays a mean for the TO line
// - type of series
grSeriesType(CHART_CompositeChart, 5, grLineMeanValue, 2)
// - label
grSeriesLabel(CHART_CompositeChart, 5, "Average TO "+ nCurrentYear)
// - type of line
grSeriesLineType(CHART_CompositeChart, 5, LineDotted)
// - line thickness
grLineThickness(CHART_CompositeChart, 5, 2)
// - color
grSeriesColor(CHART_CompositeChart, 5, RGB(215, 100, 177))
 
// Draw the chart
grDraw(CHART_CompositeChart)
Minimum version required
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 02/23/2022

Send a report | Local help