Drawing a variable number of graphs in one chart

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Drawing a variable number of graphs in one chart

#1 Post by Eugene Lutsenko »

I ask you to tell how to build a group of graphs of functions in the lines, which can be a different number. I brought a similar chart. It is desirable that the thickness of the line is proportional to the value of the parameter Int_krit, the color of the lines differed from each other.

Image

I tried to do it on the basis of the example --- Line Group (2) --- from DCCHART.PRG, but it is impossible to form a loop diagrams in the rows of the database. Error:

Code: Select all

* --- RMChart ActiveX Control --

@ 0,0 DCRMCHART oRmChart SIZE 1140, 640 RESIZE DCGUI_RESIZE_RESIZEONLY

* --- Line Group (2) ---

   ****** Сбор данных для отображения сценариев выходных параметров
   SELECT ChartClsk
   N_Col = FCOUNT()
   N_Rec = RECCOUNT()
   DBGOBOTTOM()
   PRIVATE aSrVz[N_Col]
   AFILL(aSrVz, 0)
   FOR j=6 TO N_Col
       Fv = FIELDGET(j)
       IF Fv <> 0
          aSrVz[j] = Fv
       ENDIF
   NEXT
   aLegend:= {}
   mMinY = +9999999999999
   mMaxY = -9999999999999
   FOR i=1 TO N_Rec
       DBGOTO(i)
       aData  := {}
       aLabel := {}
       FOR j=6 TO N_Col
           IF aSrVz[j] <> 0
              Fv = FIELDGET(j)
              AADD(aData , Fv)
              AADD(aLabel, ALLTRIM(FIELDNAME(j)))
              mMinY = MIN(mMinY, Fv )
              mMaxY = MAX(mMaxY, Fv )
           ENDIF
       NEXT
       AADD(aLegend, ALLTRIM(STR(i,3)))
       DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[ROUND(1+(i-1)*224/N_rec,0)]
   NEXT
   DcAddDataAxis TO aDataAxis1 AXISTEXT "Значения выходных параметров" MINVALUE mMinY MAXVALUE mMaxY

@ 5,15 DcChartRegion oRegion2 ;
   PARENT oRMChart ;
   FOOTER "Градации выходных параметров" ;
   SIZE 1100, 610 PIXEL ;
   CAPTION TITLE 'Сценарии выходных параметров' ;
   GRID ;
   LEGEND TEXT aLegend ;
   DATAAXIS aDataAxis1 ;
   LABELAXIS LABELARRAY aLabel ;
   LINEGROUP aLineGroup

   ***** Кнопки визу **********************************************************************

   @ 620, 0                    DCPUSHBUTTON CAPTION 'Помощь'                    SIZE  60,25 ACTION {||Help3_7_1()}
   @ DCGUI_ROW, DCGUI_COL + 10 DCPUSHBUTTON CAPTION 'Удалить артефакты'         SIZE 150,25 ACTION {||DelArtefact()}
   @ DCGUI_ROW, DCGUI_COL + 10 DCPUSHBUTTON CAPTION 'Записать графический файл' SIZE 170,25 ACTION {||SaveChartToBitmap(oRMChart)}
   @ DCGUI_ROW, DCGUI_COL + 10 DCPUSHBUTTON CAPTION 'Копировать в буфер обмена' SIZE 170,25 ACTION {||SaveChartToClipboard(oRMChart)}
   @ DCGUI_ROW, DCGUI_COL + 10 DCPUSHBUTTON CAPTION 'Печать'                    SIZE  55,25 ACTION {||PrintChart(oRMChart)}
   @ DCGUI_ROW, DCGUI_COL +150 DCPUSHBUTTON CAPTION 'Копировать БД Abs'         SIZE 120,25 ACTION {||SaveAbs()}
   @ DCGUI_ROW, DCGUI_COL + 10 DCPUSHBUTTON CAPTION 'Восстановить БД Abs'       SIZE 130,25 ACTION {||LoadAbs()}

   DCGETOPTIONS RESIZE PIXEL

   DCREAD GUI ;
       SETAPPWINDOW ;
       FIT ;
       TITLE '4.3.1. Результаты распознавания сценариев классов.   (C) Универсальная когнитивная аналитическая система "Эйдос-Х++"' ;
       OPTIONS GetOptions ;
       EVAL {||oRMChart:RMCToolTipWidth := 100, ;
               oRMChart:RMCUserWatermark := '(C) Универсальная когнитивная аналитическая система "Эйдос-Х++"', ;
               oRMChart:RMCUserWMAlignment := RMC_TEXTRIGHT, ;
               oRMChart:RMCUserWMFontSize := 20, ;
               oRMChart:RMCUserWMLucent := 40, ;
               oRmChart:mouseDown := ;
               {|a,b,c,d,e,o|aData := e,nWhich := a,o:=Thread():new(),o:start({||BrowseCallbackData(nWhich,aData,oRMChart)})}, ;
               oRmChart:mouseMove := ;
               {|nMouseButton,b,nX,nY,aData|oRMChart:showToolTip( nMouseButton, nX, nY, aData )}, ;
               oRmChart:draw(), ;
               ShowDebugInfo(oRMChart)}
[/size]

Also, I have not figured out how to make an inscription across the X-axis, rather than the values ​​in it.
Can I use FOOTER labeling axis X. As for the label, created FOOTER , set the alignment of the font?
How to set the thickness of the line graph?

links to the database itself, which should be built on the chart with the family of graphs and displayed above Excel-file:
http://lc.kubagro.ru/Dima/ChartClsk.rar
http://lc.kubagro.ru/Dima/ChartClsk.xls

Image
Last edited by Eugene Lutsenko on Mon May 13, 2013 2:51 am, edited 1 time in total.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Drawing a variable number of graphs in one chart

#2 Post by Eugene Lutsenko »

:mrgreen: :mrgreen: :| :whistle: :idea: :lol: :x :idea: :| :roll: :lol: :shock: :geek: :mrgreen: :lol: :| :?: :idea:
This is my grandson took part in the discussion ...

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Drawing a variable number of graphs in one chart

#3 Post by Eugene Lutsenko »

Now I care issues:
1. How to sign the axis X.
2. How to change the line thickness?
3. How to change the size of the marker?
4. Where can I get a set of bright colors (not pale)?
5. How to sign the lines themselves?
6. How to draw the X-axis at the level Y = zero?

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Drawing a variable number of graphs in one chart

#4 Post by rdonnay »

If you are intending to use RMCHART with such detailed requirements, then you should look at the RMCHART documentation that is included. You need to understand a little more about ActiveX.
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Drawing a variable number of graphs in one chart

#5 Post by Eugene Lutsenko »

Thank you for your answer! This documentation here?

Image

If so, is there any differences in the syntax of functions for VB and Alaska?
And yet, I've been using functions developed by you, like: DC_ etc.

The most primary concern is to control the line thickness.

I understand that the thickness of the line must be specified as a parameter in one of the functions:

Code: Select all

          DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[ROUND(1+(i-1)*224/N_rec,0)]

Code: Select all

@ 5,15 DcChartRegion oRegion2 ;
   PARENT oRMChart ;
   FOOTER "Градации выходных параметров" ;
   SIZE 1100, 610 PIXEL ;
   CAPTION TITLE 'СЦЕНАРИИ ВЫХОДНЫХ ПАРАМЕТРОВ, ДЛЯ КОТОРЫХ ПРОГНОЗИРУЕТСЯ ОСУЩЕСТВЛЕНИЕ:' ;
   GRID ;
   LEGEND TEXT aLegend ;
   DATAAXIS aDataAxis1 ;
   LABELAXIS LABELARRAY aLabel ;
   LINEGROUP aLineGroup
In the version with help-system eXpress++, which I have no description of the functions: DcAddLineGroup and DcChartRegion

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Drawing a variable number of graphs in one chart

#6 Post by Eugene Lutsenko »

Is it possible to be used to set the thickness of the line style of the line (something like that):

Code: Select all

   aLineStyle := {}
   AADD(aLineStyle, 'RMC_LSTYLE_LINE'       )  // 1
   AADD(aLineStyle, 'RMC_LSTYLE_SPLINE'     )  // 2
   AADD(aLineStyle, 'RMC_LSTYLE_STAIR'      )  // 3
   AADD(aLineStyle, 'RMC_LSTYLE_LINE_AREA'  )  // 4
   AADD(aLineStyle, 'RMC_LSTYLE_SPLINE_AREA')  // 5
   AADD(aLineStyle, 'RMC_LSTYLE_LINE'       )  // 1
   AADD(aLineStyle, 'RMC_LSTYLE_SPLINE'     )  // 2
   AADD(aLineStyle, 'RMC_LSTYLE_STAIR'      )  // 3
   AADD(aLineStyle, 'RMC_LSTYLE_LINE_AREA'  )  // 4
   AADD(aLineStyle, 'RMC_LSTYLE_SPLINE_AREA')  // 5
   AADD(aLineStyle, 'RMC_LSTYLE_LINE'       )  // 1
   AADD(aLineStyle, 'RMC_LSTYLE_SPLINE'     )  // 2
   AADD(aLineStyle, 'RMC_LSTYLE_STAIR'      )  // 3
   AADD(aLineStyle, 'RMC_LSTYLE_LINE_AREA'  )  // 4
   AADD(aLineStyle, 'RMC_LSTYLE_SPLINE_AREA')  // 5
   AADD(aLineStyle, 'RMC_LSTYLE_LINE'       )  // 1
   AADD(aLineStyle, 'RMC_LSTYLE_SPLINE'     )  // 2
   AADD(aLineStyle, 'RMC_LSTYLE_STAIR'      )  // 3
   AADD(aLineStyle, 'RMC_LSTYLE_LINE_AREA'  )  // 4
   AADD(aLineStyle, 'RMC_LSTYLE_SPLINE_AREA')  // 5

******************************************

      * --- RMChart ActiveX Control --

      @ 0,0 DCRMCHART oRmChart SIZE 1140, 640 RESIZE DCGUI_RESIZE_RESIZEONLY

      * --- Line Group (2) ---

      ****** Сбор данных для отображения сценариев выходных параметров
      SELECT ChartClsk
      N_Col = FCOUNT()
      N_Rec = RECCOUNT()
      DBGOBOTTOM()
      PRIVATE aSrVz[N_Col]
      AFILL(aSrVz, 0)
      aLabel := {}
      FOR j=6 TO N_Col
          Fv = FIELDGET(j)
          IF Fv <> 0
             aSrVz[j] = Fv
             AADD(aLabel, ALLTRIM(FIELDNAME(j)))
          ENDIF
      NEXT
      aLegend:= {}
      mMinY = +9999999999999
      mMaxY = -9999999999999
      FOR i=1 TO N_Rec
          DBGOTO(i)
          aData  := {}
          FOR j=6 TO N_Col
              IF aSrVz[j] <> 0
                 Fv = FIELDGET(j)
                 AADD(aData , Fv)
                 mMinY = MIN(mMinY, Fv )
                 mMaxY = MAX(mMaxY, Fv )
              ENDIF
          NEXT
          AADD(aLegend, ALLTRIM(STR(Kod_cls,15))+" "+ALLTRIM(Name_cls))
          DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[ROUND(1+(i-1)*224/N_rec,0)] LINESTYLE aLineStyle[i]  // <<<=========#######
*         DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[ROUND(1+(i-1)*224/N_rec,0)]
      NEXT
      DcAddDataAxis TO aDataAxis1 AXISTEXT "Значения выходных параметров" MINVALUE mMinY MAXVALUE mMaxY

******************************************

@ 5,15 DcChartRegion oRegion2 ;
   PARENT oRMChart ;
   FOOTER "Градации выходных параметров" ;
   SIZE 1100, 610 PIXEL ;
   CAPTION TITLE 'СЦЕНАРИИ ВЫХОДНЫХ ПАРАМЕТРОВ, ДЛЯ КОТОРЫХ ПРОГНОЗИРУЕТСЯ ОСУЩЕСТВЛЕНИЕ:' ;
   GRID ;
   LEGEND TEXT aLegend ;
   DATAAXIS aDataAxis1 ;
   LABELAXIS LABELARRAY aLabel ;
   LINEGROUP aLineGroup

   ***** Кнопки визу **********************************************************************

   @ 623, 0                    DCPUSHBUTTON CAPTION 'Помощь'                                  SIZE  70,25 ACTION {||Help3_7_1()}
   @ DCGUI_ROW, DCGUI_COL + 10 DCPUSHBUTTON CAPTION 'Записать изображение в графический файл' SIZE 250,25 ACTION {||SaveChartToBitmap(oRMChart)}
   @ DCGUI_ROW, DCGUI_COL + 10 DCPUSHBUTTON CAPTION 'Копировать изображение в буфер обмена'   SIZE 240,25 ACTION {||SaveChartToClipboard(oRMChart)}
   @ DCGUI_ROW, DCGUI_COL + 10 DCPUSHBUTTON CAPTION 'Печать изображения'                      SIZE 135,25 ACTION {||PrintChart(oRMChart)}

   DCGETOPTIONS RESIZE PIXEL

   DCREAD GUI ;
       SETAPPWINDOW ;
       FIT ;
       TITLE '4.3.1. Результаты распознавания сценариев классов.   (C) Универсальная когнитивная аналитическая система "Эйдос-Х++"' ;
       OPTIONS GetOptions ;
       EVAL {||oRMChart:RMCToolTipWidth := 100, ;
               oRMChart:RMCUserWatermark := '(C) Универсальная когнитивная аналитическая система "Эйдос-Х++"', ;
               oRMChart:RMCUserWMAlignment := RMC_TEXTRIGHT, ;
               oRMChart:RMCUserWMFontSize := 20, ;
               oRMChart:RMCUserWMLucent := 40, ;
               oRmChart:mouseDown := ;
               {|a,b,c,d,e,o|aData := e,nWhich := a,o:=Thread():new(),o:start({||BrowseCallbackData(nWhich,aData,oRMChart)})}, ;
               oRmChart:mouseMove := ;
               {|nMouseButton,b,nX,nY,aData|oRMChart:showToolTip( nMouseButton, nX, nY, aData )}, ;
               oRmChart:draw(), ;
               ShowDebugInfo(oRMChart)}
[/size]

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Drawing a variable number of graphs in one chart

#7 Post by Eugene Lutsenko »

It turned out some semblance of what I wanted, but not by the thickness of the line, it would be better, but at the expense of the line style:

Image

The code snippet of the program:

Code: Select all

   aLineStyle := {}
   AADD(aLineStyle, 'RMC_LSTYLE_LINE'       )  // 1
   AADD(aLineStyle, 'RMC_LSTYLE_SPLINE'     )  // 2
   AADD(aLineStyle, 'RMC_LSTYLE_STAIR'      )  // 3
***************************************
   aStyle := {}
   AADD(aStyle, 'RMC_LINE_FLAT_DOT'         )  //  1
   AADD(aStyle, 'RMC_LINE_FLAT_DASHDOTDOT'  )  //  2
   AADD(aStyle, 'RMC_LINE_FLAT_DASHDOT'     )  //  3
   AADD(aStyle, 'RMC_LINE_FLAT_DASH'        )  //  4
   AADD(aStyle, 'RMC_LINE_FLAT'             )  //  5
   AADD(aStyle, 'RMC_LINE_CABLE'            )  //  6
   AADD(aStyle, 'RMC_LINE_CABLE_SHADOW'     )  //  7
***************************************
      * --- RMChart ActiveX Control --

      @ 0,0 DCRMCHART oRmChart SIZE 1140, 640 RESIZE DCGUI_RESIZE_RESIZEONLY

      * --- Line Group (2) ---

      ****** Сбор данных для отображения сценариев выходных параметров
      N_Col = 10
      N_Rec = 15
      PRIVATE aSrVz[N_Col]
      AFILL(aSrVz, 0)
      aLabel := {}
      FOR j=6 TO N_Col
          aSrVz[j] = 1
          AADD(aLabel, "N"+ALLTRIM(STR(j-6)))
      NEXT
      aLegend:= {}
      mMinY = +9999999999999
      mMaxY = -9999999999999
*     FOR i=1 TO N_Rec
      FOR i=1 TO 7
          aData  := {}
          FOR j=6 TO N_Col
              IF aSrVz[j] <> 0
                 Fv = i*10+j
                 AADD(aData , Fv)
                 mMinY = MIN(mMinY, Fv )
                 mMaxY = MAX(mMaxY, Fv )
              ENDIF
          NEXT
          AADD(aLegend, ALLTRIM(STR(i,3)))
*         DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[i] STYLE aStyle[i] LINESTYLE RMC_LSTYLE_SPLINE
          mStyle = aStyle[6]
          DO CASE
             CASE i = 1
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_FLAT_DOT        LINESTYLE RMC_LSTYLE_LINE
             CASE i = 2
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_FLAT_DASHDOTDOT LINESTYLE RMC_LSTYLE_LINE
             CASE i = 3
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_FLAT_DASHDOT    LINESTYLE RMC_LSTYLE_LINE
             CASE i = 4
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_FLAT_DASH       LINESTYLE RMC_LSTYLE_LINE
             CASE i = 5
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_FLAT            LINESTYLE RMC_LSTYLE_LINE
             CASE i = 6
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_CABLE           LINESTYLE RMC_LSTYLE_LINE
             CASE i = 7
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_CABLE_SHADOW    LINESTYLE RMC_LSTYLE_LINE
          ENDCASE
      NEXT
      DcAddDataAxis TO aDataAxis1 AXISTEXT "Значения выходных параметров" MINVALUE mMinY MAXVALUE mMaxY
*********************************
[/size]

Yet it is strange that the design does not work:

Code: Select all

DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[i] STYLE aStyle[i] LINESTYLE RMC_LSTYLE_SPLINE
and we have to use:

Code: Select all

          DO CASE
             CASE i = 1
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_FLAT_DOT        LINESTYLE RMC_LSTYLE_LINE
             CASE i = 2
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_FLAT_DASHDOTDOT LINESTYLE RMC_LSTYLE_LINE
             CASE i = 3
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_FLAT_DASHDOT    LINESTYLE RMC_LSTYLE_LINE
             CASE i = 4
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_FLAT_DASH       LINESTYLE RMC_LSTYLE_LINE
             CASE i = 5
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_FLAT            LINESTYLE RMC_LSTYLE_LINE
             CASE i = 6
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_CABLE           LINESTYLE RMC_LSTYLE_LINE
             CASE i = 7
                  DcAddLineGroup TO aLineGroup DATA aData COLOR aColor[7] STYLE RMC_LINE_CABLE_SHADOW    LINESTYLE RMC_LSTYLE_LINE
          ENDCASE
although a similar structure with an array of colors is operating normally.

I can not see too much different styles: RMC_LINE_CABLE and RMC_LINE_CABLE_SHADOW

Maybe you can set the style of the line: "thickness"?

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Drawing a variable number of graphs in one chart

#8 Post by rdonnay »

Eugene -

I would like to help you with this, but I am overloaded with work right now.
Before the devcon in October, I intend to write a program that lets you test different options by filling them in on a screen and then running the code.

That will take me days to write but it will be worth it.
I don't have the time for this now.

Hopefully, my workload will wind down a bit during the summer.

Roger
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Drawing a variable number of graphs in one chart

#9 Post by Eugene Lutsenko »

Roger!

I wish you health and success in your quality work, which I am absolutely certain, very much needed, and many developers in Alaska around the world. You give us great tools and gives us hope that the future will be even better.

And I'll try to do as long as the funds available, which I slowly learn.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Drawing a variable number of graphs in one chart

#10 Post by Eugene Lutsenko »

So far made ​​about the fact that up to, without the use of a different line thickness, and due to its style (one point, point-to-point-dash, dot-dash, one dash, solid, cable). Not exactly what they wanted, but so far the best times to go, that is, to the time when I will learn to make different line thickness.

Image

Post Reply