kamaci
kamaci

Reputation: 75257

How to make individual points at JChart2D?

I am using JChart2D for my Java desktop application and followed that example:

http://jchart2d.sourceforge.net/usage.shtml

That example makes connections between points however I need individual points.

I mean I get something like:

enter image description here

But I want something like:

enter image description here

PS: Graphic examples are different just I wanted to show difference between individual points and line between points.

Upvotes: 0

Views: 1494

Answers (3)

Achim
Achim

Reputation: 31

Close, but no cigar. The correct API Call is:

Chart2D chart = new Chart2D();
ITrace2D trace = new Trace2DSimple();
// Add the trace to the chart:
chart.addTrace(trace);
trace.setTracePainter(new TracePainterDisc(4));

The call

trace.setTracePainter(new TracePainterDisc(4)); 

does the trick.

Upvotes: 3

Chris
Chris

Reputation: 1

trace.setTracePainter(new TracePainterDisc());

Upvotes: 0

Stephan
Stephan

Reputation: 4443

I think the answer lies in the link you posted above.

Create a trace (instance of ITrace2D) and set the PointPainter e.g. to PointPainterDisc.

Derived from the API javadoc:

Chart2D test = new Chart2D();
JFrame frame = new JFrame("Chart2D- Debug");

frame.setSize(400,200);
frame.setVisible(true);
ITrace2D atrace = new Trace2DLtd(100);

atrace.setPointHighlighter(new PointPainterDisc(5));
test.addTrace(atrace);
while(expression){
  atrace.addPoint(adouble,bdouble);
  ....
}

Upvotes: 0

Related Questions