ChartServer sampleChart = new ChartServer(pageContext,request,response);
sampleChart.getData().set(0, 0, 120.1); sampleChart.getData().set(0, 1, 160.2); sampleChart.getData().set(0, 2, 750.9); sampleChart.getData().set(0, 3, 110.4);
// Y축 자릿수구분 sampleChart.getAxisY().getLabelsFormat().setCustomFormat("###,###");
// PointLabel sampleChart.getAllSeries().getPointLabels().setFormat("%v건");
// Legend sampleChart.getLegendBox().setVisible(false); // 활성화 여부
// 챠트 여백조절 및 사이즈 sampleChart.getPlotAreaMargin().setTop(60); sampleChart.getPlotAreaMargin().setLeft(90); sampleChart.getPlotAreaMargin().setRight(90); sampleChart.getPlotAreaMargin().setBottom(80); sampleChart.setWidth(480); sampleChart.setHeight(386);
// 기타설정 sampleChart.getImageSettings().setQuality(100); // 이미지 퀄리티 sampleChart.getImageSettings().setInteractive(false); // 상호작용 해제
// 포인트 별 색상 sampleChart.getSeries().get(0).setColor(new java.awt.Color(237, 132, 132));
sampleChart.getAxisX().getGrids().getMajor().setVisible(false); sampleChart.getAxisY().getGrids().getMajor().setStyle(DashStyle.SOLID);
// Chart style : LINES sampleChart.setAxesStyle(AxesStyle.MATH); sampleChart.getAllSeries().getLine().setWidth((short) 2.4); // 라인챠트 선 두께 sampleChart.getAllSeries().getLine().setStyle(DashStyle.DASH); sampleChart.getAllSeries().setMarkerSize((short) 4); // Marker 사이즈 sampleChart.getAllSeries().setMarkerShape(MarkerShape.RECT); // Marker 종류 sampleChart.getAllSeries().setFillMode(FillMode.SOLID); // 채움타입
sampleChart.getSeries().get(0).setGallery(Gallery.LINES);
// 그리드라인 1 CustomGridLine custom1 = new CustomGridLine(); custom1.setValue(Double.parseDouble("590")); custom1.setColor(java.awt.Color.GREEN); custom1.setWidth(2); custom1.setStyle(DashStyle.DOT); custom1.setText(" 상한"); custom1.setFont(new java.awt.Font("맑은 고딕",java.awt.Font.TRUETYPE_FONT, 12)); custom1.setTextColor(java.awt.Color.BLACK); custom1.setOutsideText(true); custom1.setAlignment(StringAlignment.FAR); custom1.setLineAlignment(StringAlignment.CENTER); sampleChart.getAxisY().getCustomGridLines().add(custom1);
// 그리드라인 2 CustomGridLine custom2 = new CustomGridLine(); custom2.setValue(Double.parseDouble("220")); custom2.setWidth(2); custom2.setColor(java.awt.Color.GREEN); custom2.setStyle(DashStyle.DOT); custom2.setText(" 하한"); custom2.setFont(new java.awt.Font("맑은 고딕",java.awt.Font.TRUETYPE_FONT, 11)); custom2.setTextColor(java.awt.Color.BLACK); custom2.setOutsideText(true); custom2.setAlignment(StringAlignment.FAR); custom2.setLineAlignment(StringAlignment.CENTER); sampleChart.getAxisY().getCustomGridLines().add(custom2);
// 렌더링 sampleChart.renderControl();
|