Graph height now percent rather than pixels

This commit is contained in:
James Alliban
2014-01-11 20:00:46 +00:00
parent 5ed4e96a1d
commit ec0b69726c
8 changed files with 14 additions and 40 deletions
+3 -3
View File
@@ -81,7 +81,7 @@ void GUI::addBarGraphDesignGUI()
gui->addSlider("Graph Item X Gap", 5, 50, &app->scene.barGraph.graphItemXGap, length, dim);
gui->addSlider("BarWidth", 2, 50, &app->scene.barGraph.barWidth, length, dim);
gui->addSlider("Graph Height Max", 100, 1000, &app->scene.barGraph.graphHeightMax, length, dim);
gui->addSlider("Graph Height Max", 0, 1, &app->scene.barGraph.graphHeightMax, length, dim);
gui->addSlider("Data send speed (seconds)", 0.1, 20, &app->scene.barGraph.sendDataSpeed, length, dim);
gui->addSpacer(length, 1);
@@ -109,7 +109,7 @@ void GUI::addBodyGraphDesignGUI()
gui->addToggle("Toggle Draw Lines", &app->scene.bodyGraph.isDrawLines, toggleDim, toggleDim);
gui->addSlider("Graph Item X Gap", 5, 50, &app->scene.bodyGraph.graphItemXGap, length, dim);
gui->addSlider("Line width", 1, 50, &app->scene.bodyGraph.lineWidth, length, dim);
gui->addSlider("Graph Height Max", 100, 1000, &app->scene.bodyGraph.graphHeightMax, length, dim);
gui->addSlider("Graph Height Max", 0, 1, &app->scene.bodyGraph.graphHeightMax, length, dim);
gui->addSlider("Data send speed (seconds)", 0.1, 20, &app->scene.bodyGraph.sendDataSpeed, length, dim);
gui->addSpacer(length, 1);
@@ -136,7 +136,7 @@ void GUI::addSeparateBodyGraphDesignGUI()
gui->addToggle("Toggle Draw Lines", &app->scene.separateBodyGraph.isDrawLines, toggleDim, toggleDim);
gui->addSlider("Graph Item X Gap", 5, 50, &app->scene.separateBodyGraph.graphItemXGap, length, dim);
gui->addSlider("Line width", 1, 50, &app->scene.separateBodyGraph.lineWidth, length, dim);
gui->addSlider("Graph Height Max", 100, 1000, &app->scene.separateBodyGraph.graphHeightMax, length, dim);
gui->addSlider("Graph Height Max", 0, 1, &app->scene.separateBodyGraph.graphHeightMax, length, dim);
gui->addSlider("Graph bottom end (percent)", 0, 2, &app->scene.separateBodyGraph.graphEndPercent, length, dim);
gui->addSlider("Data send speed (seconds)", 0.1, 20, &app->scene.separateBodyGraph.sendDataSpeed, length, dim);
@@ -51,8 +51,8 @@ void BarGraph::draw()
}
float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent;
float outputMin = (ofGetHeight() * 0.5) - graphHeightMax;
float outputMax = (ofGetHeight() * 0.5) + graphHeightMax;
float outputMin = (ofGetHeight() * 0.5) - ((ofGetHeight() * 0.5) * graphHeightMax);
float outputMax = (ofGetHeight() * 0.5) + ((ofGetHeight() * 0.5) * graphHeightMax);
for (int i = 0; i < publisher0Data.size() - 1; i++)
{
@@ -32,20 +32,9 @@ void BodyGraph::draw()
if (publisher0Data.size() > 1)
{
//for (int i = 0; i < publisher0Data.size() - 1; i++)
//{
// ofPushStyle();
// ofSetColor(255, 0, 0);
// ofCircle(i * graphItemXGap, publisher0Data[i], 5);
// ofSetColor(0, 255, 0);
// ofCircle(i * graphItemXGap, publisher1Data[i], 5);
// ofPopStyle();
//}
float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent;
float outputMin = (ofGetHeight() * 0.5) - graphHeightMax;
float outputMax = (ofGetHeight() * 0.5) + graphHeightMax;
float outputMin = (ofGetHeight() * 0.5) - ((ofGetHeight() * 0.5) * graphHeightMax);
float outputMax = (ofGetHeight() * 0.5) + ((ofGetHeight() * 0.5) * graphHeightMax);
if (isDrawBody)
{
@@ -31,27 +31,12 @@ void SeparateBodyGraph::draw()
if (publisher0Data.size() > 1)
{
//for (int i = 0; i < publisher0Data.size() - 1; i++)
//{
// ofPushStyle();
// ofSetColor(255, 0, 0);
// ofCircle(i * graphItemXGap, publisher0Data[i], 5);
// ofSetColor(0, 255, 0);
// ofCircle(i * graphItemXGap, publisher1Data[i], 5);
// ofPopStyle();
//}
ofMesh body0 = getMesh(publisher0Data, col0);
ofMesh body1 = getMesh(publisher1Data, col1);
float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent;
float outputMin = (ofGetHeight() * 0.5) - graphHeightMax;
float outputMax = (ofGetHeight() * 0.5) + graphHeightMax;
float outputMin = (ofGetHeight() * 0.5) - ((ofGetHeight() * 0.5) * graphHeightMax);
float outputMax = (ofGetHeight() * 0.5) + ((ofGetHeight() * 0.5) * graphHeightMax);
// draw lines
@@ -141,8 +126,8 @@ ofMesh SeparateBodyGraph::getMesh(vector<DataObject> publisherData, float* col)
{
ofMesh bodyMesh;
float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent;
float outputMin = (ofGetHeight() * 0.5) - graphHeightMax;
float outputMax = (ofGetHeight() * 0.5) + graphHeightMax;
float outputMin = (ofGetHeight() * 0.5) - ((ofGetHeight() * 0.5) * graphHeightMax);
float outputMax = (ofGetHeight() * 0.5) + ((ofGetHeight() * 0.5) * graphHeightMax);
// draw main part of graph (xOffset)
bodyMesh.setMode(OF_PRIMITIVE_TRIANGLE_STRIP);