I want to visualize some data about cars in a table via Prefuse Java. Three kinds of important data objects are used:
- PIT (Point in Time)
- Value (contains the consumption of gas as a Double)
- Car (the class that represents a Car)
So first I put them into a table like this:
car1 | pit1 | value11
car1 | pit2 | value12
car1 | pit3 | value13
car2 | pit1 | value21
car2 | pit2 | value22
car2 | pit3 | value23
car3 | pit1 | value31
car3 | pit2 | value32
car3 | pit3 | value33
Using the examples in the Prefuse project I was able to create a visualization of a table with the x-axis labeled with pit1, pit2 and pit3 and the y-axis with the different values in correct order.
But what I've tried for hours is to somehow draw little squares at the corresponding spots (like a red square for car1 where pit1 and value11 "meet").
How do I do this?
PS: I also would like to know how to improve the y-axis in the following way:
Imagine the lowest value is 2.6 and the highest is 32.0. Right now the y-axis would start with 2.6 and just label every value (with the same space between the labels regardless of the actual difference) up to 32.0. What I would prefer is that the labels would start with 0.0 (or 2.0) and then use steps of 5 or so till 35.
You want to visualize your table in a scatter plot with PIT on the x-axis, Value on the y-axis, and Car as the color of the marks (= rectangles).
If I understood you correctly, you see the axis labels but no marks.
You need to add a
ColorAction
to your action list in order to see the marks. For example:Or use a
DataColorAction
, which allows you to visualize marks in different color depending on Car:Regarding the y-axis: prefuse draws every label and ignores actual difference, if it cannot read the variable (here: Value) as a double. Please check if it is stored as
Double
orString
. If you want to start at0.0
you you can set a range model:PS: I have written a tutorial for prefuse scatter plots: http://www.ifs.tuwien.ac.at/~rind/w/doku.php/java/prefuse-scatterplot