Problem Graphing data

first delete all the widget from the dashboard.
change the following line :

to

Cayenne.loop();
if (millis() - lastMillis > 10000) {
lastMillis = millis();
    Cayenne.virtualWrite(HEART_VIRTUAL_CHANNEL, analogRead(SENSOR_PIN2), "analog_sensor", "null");

    Cayenne.celsiusWrite(TEMPERATURE_VIRTUAL_CHANNEL,analogRead(SENSOR_PIN1)*5/1024.0-(-0.3)/0.01, "analog_sensor", "null");
//Cayenne.virtualWrite(TEMPERATURE_VIRTUAL_CHANNEL, analogRead(SENSOR_PIN1)*5/1024.0-(-0.3)/0.01, "temp", "c")

Cayenne.virtualWrite(3, accel.acceleration.x, "accel", "g");
Cayenne.virtualWrite(4, accel.acceleration.y, "accel", "g");
Cayenne.virtualWrite(5, accel.acceleration.z, "accel", "g");
}

once you upload the code. the dashboard will be populated with a temporary green color widget. click on “+” add them to your dashboard.
click on the setting “gear icon” and change the choose widget to line chart.

in your code if (millis() - lastMillis > 2000) this line used to send data every 2 sec which I have changed to 10 sec as the sending data more then the rate limit will cause interrupt in connection. also, you were sending the acceleration value continuously so I have placed it inside the if function. have a look at this Sending MQTT messages within rate limits

why you want to do this?