Scaling a line graph on a PIDs oled display

I am making a PID with some parts I have around. Most of it seems to be working great, except for one thing. I have a line graph on the display that shows the last 2 mins of temperature. This graph scales based on what the highest and lowest values in that time has been. This scaling works great, until it gets above 1 deg per dot, the the graph vanishes until the temperature range for the last 2 minutes goes back below 1 deg per dot. When I do the math myself, It looks like it should work right, but I've been staring at this code for nearly 20 hours (over 2 days) and still cant figure it out. Hopefully its just something silly and another set of eyes will catch it. Also, I'm getting low on ram for this project, so if you happen to see a place I can trim, please let me know.

I'm leaving off the include files since they are fairly common. I did make a few modifications, but I'm confident they are not the problem. If you think they are the problem, let me know, and Ill add the modified versions I've made. The second set of code is just copied from the first set, this is the problem spot (I think).

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "max6675.h"
#include <PID_v1.h>

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
int GraphTop;
int GraphBot;
unsigned long Gtime = 0;
int GraphVal[128];


byte thermoDO = 8;
byte thermoCS = 9;
byte thermoCLK = 6;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
unsigned long Ttime = 0;
int temp;

#define RELAY_PIN 10
long Setpoint, Input, Output;
byte Kp=2, Ki=5, Kd=1;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
int WindowSize = 5000;
unsigned long windowStartTime;

byte i = 0;

void setup()   {                
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);

  windowStartTime = millis();
  Setpoint = 700;
  myPID.SetOutputLimits(0, WindowSize);
  myPID.SetMode(AUTOMATIC);

  for (i = 0; i<128; i++) {
    GraphVal[i] = 100;
  }
  delay(1000);
}


void loop() {
  if (millis() > Ttime) {
    temp = thermocouple.readFahrenheit();
    Input = temp;
    Ttime = millis() + 250;
  }

  if(millis() > Gtime) {
    GraphTop = GraphVal[1];
    GraphBot = GraphVal[1];
    for (i = 0; i < 127; i++) {
      GraphVal[i] = GraphVal[(i + 1)];
    }
    GraphVal[127] = temp;
    for (i = 0; i < 128; i++){
      if (GraphVal[i] > GraphTop) 
        GraphTop = GraphVal[i];
      if (GraphVal[i] < GraphBot)
        GraphBot = GraphVal[i];
    }
    if (GraphTop-GraphBot<24) {
      GraphTop=GraphTop+((24-(GraphTop-GraphBot))/2);
      GraphBot=GraphTop-24;
    }
    Gtime=millis()+500;
  }
  myPID.Compute();
  if (millis() - windowStartTime > WindowSize) 
    windowStartTime += WindowSize;
  if (Output < millis() - windowStartTime)
    digitalWrite(RELAY_PIN, HIGH);
  else 
    digitalWrite(RELAY_PIN, LOW);
   
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.print("Set: ");
  display.print(Setpoint);
  display.print((char)247);
  display.print("F");
  display.setCursor(0,8); 
  display.print("Temp: ");
  display.print(temp);
  display.print((char)247);
  display.print("F");
  display.setCursor(0,16);
  display.print(GraphTop);
  display.setCursor(0,56);
  display.print(GraphBot);
  for (i = 0; i < 128; i++) { 
    display.drawPixel(i,64 - ((GraphVal[i]-GraphBot)*(48/(GraphTop-GraphBot))), WHITE);
  }
  display.display();
}
  for (i = 0; i < 128; i++) { 
    display.drawPixel(i,64 - ((GraphVal[i]-GraphBot)*(48/(GraphTop-GraphBot))), WHITE);
  }

Specifically, I think the problem is in how I am calculating where the verticle position of the pixel (based on temp): 64 - ((GraphVal(i)-GraphBot)*(48/(GraphTop-GraphBot)))

This all seems to work properly, until GraphTop-GraphBot>48...then the graph goes poof

I tried separating out that equation into several (4) smaller ones, but that didnt help and only took up some of the valuable 170ish bytes of ram I have left.

I also tried an If statement with conditionals and a separate equation for handling the 49+ situation, but this solution allowed the graph to go above the 17th line of pixels, where some text is residing. This method seemed to simply allow the graph to keep going past the edge of the screen, without descaling the graph. Unfortunately, I cant replicate how I did this, and don't remember what the code was (frustration won and I rage-quit with no save).

In case it matters, this is running on a Nano 328.

Thanks for any advice/tips/suggestions/solutions in advance.

Here's my initial guess.

Change:

64 - ((GraphVal[i]-GraphBot)*(48/(GraphTop-GraphBot)))

To:

64 - (((GraphVal[i]-GraphBot)*48)/(GraphTop-GraphBot))

DuaneDegn:
Here's my initial guess.

Change:

64 - ((GraphVal[i]-GraphBot)*(48/(GraphTop-GraphBot)))

To:

64 - (((GraphVal[i]-GraphBot)*48)/(GraphTop-GraphBot))

Such a minor change for such perfect results. Thanks a lot, you probably saved me another 20 hours of frustration.