James Bott wrote:Hebert,
How about putting two graphs on the same page each with a different Y axis scale and the same X axis scale?
James
#include "Fivewin.ch"
#include "TGraph.ch"
FUNCTION MAIN()
LOCAL oDlg, oGraph1, oGraph2
DEFINE DIALOG oDlg;
SIZE 600, 500
@ 1, 1 GRAPH oGraph1;
SIZE 250, 200;
TYPE 3;
YVALUES 3D XGRID YGRID XVALUES LEGENDS
@ 1, 1 GRAPH oGraph2;
SIZE 250, 200;
TYPE 3;
YVALUES 3D XGRID YGRID XVALUES LEGENDS
oGraph1:aSeries = { { "Crude Oil MBD", CLR_GREEN ,, }}
oGraph2:aSeries = { { "", CLR_GREEN ,, },{ "Gas MMPCD", CLR_HRED ,, }}
oGraph1:aData = { { 14280, 20420, 12870, 25347, 7640 }}
oGraph2:aData = { {0,0,0,0,0 },{ 7520000, 11220760, 9745154, 10125000, 12210000 }}
oGraph1:nClrX = CLR_GREEN
oGraph1:nClrY = CLR_RED
oGraph2:nClrX = CLR_GREEN
oGraph2:nClrY = CLR_RED
@ 0, 0 BUTTON "Change" ACTION ( oGraph1:nType :=1 , oGraph1:Refresh() )
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
James Bott wrote:Heber,
As I suggested, try dividing all the gas values by 10 and plotting them. If that works then all you have to do is figure out how to place the Y-axis values on the right side.
But also, think of the bigger picture. Maybe there is a better way to find answers. That's why I also suggested plotting the difference between the two values. Sometimes you have to give them what they need instead of, or in addition to, what they want.
James
/*
Purpose: Test charting to items with vastly different scales on the same chart
Author : James Bott
For : Hebert Vargas
Date : 08/07/2017 07:28:29 AM
*/
#include "Fivewin.ch"
#include "TGraph.ch"
FUNCTION MAIN()
LOCAL oDlg, oGraph, aData1, aData2, i
// Assign the data
aData1:= { 14280, 20420, 12870, 25347, 7640 }
aData2:= { 7520000, 11220760, 9745154, 10125000, 12210000 }
// Modify aData2 array values to fit chart scale
for i = 1 to len(aData2)
aData2[i] := aData2[i] / 1000 * 2.1
next
DEFINE DIALOG oDlg;
SIZE 600, 500
@ 1, 1 GRAPH oGraph;
SIZE 285, 220;
TYPE 3;
YVALUES 3D XGRID YGRID XVALUES LEGENDS
oGraph:nPoint:=1
//msgInfo( oGraph:nPenWidth)
oGraph:nPenWidth:=5 // has no effect on pen width. (bug?)
oGraph:nType := 3 // 3=line chart
oGraph:cSubTit:= "Oil & Gas Flow Rates"
oGraph:aSeries = { { "Crude Oil MBD", CLR_HBLUE ,, },{ "Gas MMPCD", CLR_HRED ,, }}
oGraph:aData = { aData1 , aData2 }
// Y-axis data. Note they are incorrectly labled "X"
oGraph:nMaxVal:= 30000
oGraph:nXRanges:= 6 // number of y-axis label increments
oGraph:cTitX := "Oil Flow Rate MBD"
// X-Axis data. Note that they are incorrectly labled with a "Y"
oGraph:aYVals = { "1", "2", "3", "4", "5" } // Should these be dates?
oGraph:cTitY:="Days?"
ACTIVATE DIALOG oDlg;
CENTER
//msgInfo( oGraph:nPenWidth )
RETURN NIL
// EOF
James Bott wrote:Here's the source. Remember, don't copy it using MS Edge.
James
- Code: Select all Expand view RUN
/*
Purpose: Test charting to items with vastly different scales on the same chart
Author : James Bott
For : Hebert Vargas
Date : 08/07/2017 07:28:29 AM
*/
#include "Fivewin.ch"
#include "TGraph.ch"
FUNCTION MAIN()
LOCAL oDlg, oGraph, aData1, aData2, i
// Assign the data
aData1:= { 14280, 20420, 12870, 25347, 7640 }
aData2:= { 7520000, 11220760, 9745154, 10125000, 12210000 }
// Modify aData2 array values to fit chart scale
for i = 1 to len(aData2)
aData2[i] := aData2[i] / 1000 * 2.1
next
DEFINE DIALOG oDlg;
SIZE 600, 500
@ 1, 1 GRAPH oGraph;
SIZE 285, 220;
TYPE 3;
YVALUES 3D XGRID YGRID XVALUES LEGENDS
oGraph:nPoint:=1
//msgInfo( oGraph:nPenWidth)
oGraph:nPenWidth:=5 // has no effect on pen width. (bug?)
oGraph:nType := 3 // 3=line chart
oGraph:cSubTit:= "Oil & Gas Flow Rates"
oGraph:aSeries = { { "Crude Oil MBD", CLR_HBLUE ,, },{ "Gas MMPCD", CLR_HRED ,, }}
oGraph:aData = { aData1 , aData2 }
// Y-axis data. Note they are incorrectly labled "X"
oGraph:nMaxVal:= 30000
oGraph:nXRanges:= 6 // number of y-axis label increments
oGraph:cTitX := "Oil Flow Rate MBD"
// X-Axis data. Note that they are incorrectly labled with a "Y"
oGraph:aYVals = { "1", "2", "3", "4", "5" } // Should these be dates?
oGraph:cTitY:="Days?"
ACTIVATE DIALOG oDlg;
CENTER
//msgInfo( oGraph:nPenWidth )
RETURN NIL
// EOF
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 39 guests