Hi,
I am working on a custom data visualization program.
My question is how to display/map/transform the data from a model to the view/scene in order to:
1. Get correct results
2. Minimize computational effort
So far, in order to draw a scatterplot, I came up with two different approaches:
Here is a short pseudocode:
//initialize data
A[5], B[5]
i=0
//fill vectors with randon data
while (i < 5)
A[i] = rand(10);
B[i] = rand(10);
i++;
myGraphicsScene->addRect(A[i], -B[i], 5, 5);
//set scene
myGraphcisView->setScene(myGraphicsscene)
//initialize data
A[5], B[5]
i=0
//fill vectors with randon data
while (i < 5)
A[i] = rand(10);
B[i] = rand(10);
i++;
myGraphicsScene->addRect(A[i], -B[i], 5, 5);
//set scene
myGraphcisView->setScene(myGraphicsscene)
To copy to clipboard, switch view to plain text mode
Since the data is not scaled to the scene coordinates there are two different ways to plot the data (from my current understanding):
1. Transform/multiply the data with some factor to expess the values in terms of scene coordinates
2. Fit the scene to the data (myScene->sceneRect(0,-max(B), max(A), max(B)) and then fit the scene to the graphicsview using myview -> fitInView(myscene)
Now from your experience, which approach would you recommend?
Are there another way to approach the problem?
Thank you many times,
Vincent
Bookmarks