1
在JChart2D系列中的點可以用小圓圈或通過點繪製的線繪製。我需要將用戶的注意力吸引到某些特定的要點上。如何在JChart2D中標記特殊數據點?
我該如何用填充的圓圈或其他某種符號來標記偶爾的點。
提供的垂直欄畫家似乎將整個繪圖更改爲垂直條形圖(在其出現的位置以及對舊點的「追溯」)。我不要那個。我只需要使單點看起來特別,例如,在X = 5點。
Chart2D chart = new Chart2D();
ITrace2D myTrace = new Trace2DLtd(100);
myTrace.setColor(Color.RED);
myTrace.setTracePainter(new TracePainterDisc()); // circle; not filled
chart.addTrace(myTrace);
JFrame frame = new JFrame(Constants.graphTitle);
frame.getContentPane().add(chart);
frame.setSize(200, 200);
frame.addWindowListener(
new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
}
);
frame.setVisible(true);
List<Point> list = Helper.makeList();
for (Point p: list)
{
if (p.x != 5)
myTrace.addPoint(p.x, p.y);
else
{
// MAKE THIS POINT LOOK DIFFERENT, BUT HOW?
myTrace.addPoint(p.x, p.y);
}
}
}
}