Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
507 views
in Technique[技术] by (71.8m points)

java - How to draw line over a JFreeChart chart?

I have updatable OHLCChart. I need to draw a line over chart.

How to implement it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to draw a vertical or horizontal line at a given position on an axis, you can use a ValueMarker :

ValueMarker marker = new ValueMarker(position);  // position is the value on the axis
marker.setPaint(Color.black);
//marker.setLabel("here"); // see JavaDoc for labels, colors, strokes

XYPlot plot = (XYPlot) chart.getPlot();
plot.addDomainMarker(marker);

Use plot.addRangeMarker() if you want to draw an horizontal line.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...