Question

I want to visualize a scatter plot using Prefuse. The difference from typical scatter plot is here I want to use rectangle instead of circle or point. And the reason is I want to visualize the time and duration at the same time. Does anyone know how to set rectangle's length or width according to data in the table? I haven't got the right answer after searching the web.

I initially wants to draw rectangle using this parameter.

    ShapeAction shape = new ShapeAction(group, Constants.SHAPE_RECTANGLE);

But I didn't find the way to change only the length of it but to change the whole size. Could anyone give me some instructions? Thanks.

Was it helpful?

Solution

Assuming you want to create a visualization similar to LifeLines or a GANTT chart.

To achive this, prefuse has to be extended prefuse on several points. Here is an outline:

  1. Add a field to the VisualTable to store the x coordinate at the end of the rectangle
  2. Extend AxisLayout to determine the additionally the end of the rectangle.
  3. Extend AbstractShapeRenderer draw a rectangle using the end coordinate
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top