Support Board
Date/Time: Sat, 10 May 2025 13:10:55 +0000
Post From: Is there a way to lock multiple indicators in a subgraph to a single zero line in the middle?
[2015-07-20 07:43:45] |
bjohnson777 (Brett Johnson) - Posts: 284 |
Thanks for all the replies. Tomgilb's is the closest, but it still comes down to a varying multiplier that will shrink or expand the graph based on what's visible. This is the code I used in my scratch pad graph output program I've been working on the past couple years. I was hoping something similar could be added to the "Scale" button since it is simple. Note that I prefix local function variables with 'f' since I've got some global variables I want to make sure I don't interact with. //Scale plot to 100 range, mainly used for chart combining.
double TAScale100Auto(const int fIndexStart, const int fIndexEnd, double *fArray) { int i; double fLow, fHigh, fMultiplier; fLow = fArray[fIndexStart]; fHigh = fArray[fIndexStart]; //find the lowest and highest numbers. for(i=fIndexStart; i<=fIndexEnd; i++) { if(fLow > fArray[i]) {fLow = fArray[i];} if(fHigh < fArray[i]) {fHigh = fArray[i];} } //scale the range, 50.0 center point. fMultiplier = 100.0 / (fHigh - fLow); for(i=fIndexStart; i<=fIndexEnd; i++) { fArray[i] = (fArray[i] - fLow) * fMultiplier; if(fArray[i]>100.0) {fArray[i]=100.0;} if(fArray[i]<0.0) {fArray[i]=0.0;} } return fMultiplier; } //end double TAScale100Auto |