import com.imsl.chart.*; import java.awt.Color; public class SampleLegend extends JFrameChart { public SampleLegend() { Chart chart = getChart(); AxisXY axis = new AxisXY(chart); Legend legend = chart.getLegend(); legend.setPaint(true); legend.setTitle("Legend"); legend.setTextColor(Color.white); legend.setFillType(legend.FILL_TYPE_SOLID); legend.setViewport(0.3, 0.4, 0.1, 0.4); double y1[] = {4, 6, 2, 1, 8}; Data data1 = new Data(axis, y1); data1.setDataType(Data.DATA_TYPE_LINE); data1.setLineColor(Color.red); data1.setTitle("Line"); double y2[] = {7, 3, 4, 5, 2}; Data data2 = new Data(axis, y2); data2.setDataType(Data.DATA_TYPE_MARKER); data2.setMarkerColor(Color.blue); data2.setTitle("Marker"); } public static void main(String argv[]) { new SampleLegend().setVisible(true); } }