Revision 19527 trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/scatterplot/gui/ChartScaterPlotPanel.java
ChartScaterPlotPanel.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
import java.awt.BorderLayout; |
44 | 44 |
import java.awt.Color; |
45 |
import java.awt.color.ColorSpace; |
|
45 | 46 |
|
46 | 47 |
import javax.swing.JPanel; |
47 | 48 |
|
... | ... | |
81 | 82 |
private float data[][] = null; |
82 | 83 |
FLayer fLayer = null; |
83 | 84 |
int initialRenderBand[] = null; |
85 |
//private Color colorChart= new Color(255,255,255); |
|
86 |
//private Color colorBackground = new Color (0,0,0); |
|
84 | 87 |
|
85 | 88 |
/** |
86 | 89 |
* Constructor |
... | ... | |
93 | 96 |
initialRenderBand = ((FLyrRasterSE) fLayer).getRenderBands(); |
94 | 97 |
bandaX= band1; |
95 | 98 |
bandaY= band2; |
96 |
createChart(); |
|
99 |
createChart(Color.BLACK,Color.WHITE,Color.WHITE);
|
|
97 | 100 |
initialize(); |
98 | 101 |
} |
99 | 102 |
|
... | ... | |
126 | 129 |
* setDataChart() para cargar los datos a representar |
127 | 130 |
* |
128 | 131 |
* */ |
129 |
private void createChart() { |
|
132 |
private void createChart(Color colorChart, Color colorBackground, Color colorExternal) {
|
|
130 | 133 |
|
131 |
NumberAxis domainAxis = new NumberAxis(PluginServices.getText(this,"banda")+" "+bandaX);
|
|
134 |
NumberAxis domainAxis = new NumberAxis(PluginServices.getText(this,"banda")+" "+(bandaX+1));
|
|
132 | 135 |
domainAxis.setAutoRangeIncludesZero(false); |
133 |
NumberAxis rangeAxis = new NumberAxis(PluginServices.getText(this,"banda")+" "+bandaY);
|
|
136 |
NumberAxis rangeAxis = new NumberAxis(PluginServices.getText(this,"banda")+" "+(bandaY+1));
|
|
134 | 137 |
rangeAxis.setAutoRangeIncludesZero(false); |
135 | 138 |
|
136 | 139 |
// Se cargan los datos antes de construir el grafico |
137 | 140 |
setDataChart(fLayer); |
138 | 141 |
plot = new ScatterPlotChart(this.data, domainAxis, rangeAxis); |
139 |
|
|
140 |
|
|
141 | 142 |
chart = new JFreeChart(PluginServices.getText(this,"diagrama_dispersion"), plot); |
142 | 143 |
data= null; |
143 | 144 |
chart.getRenderingHints().clear(); |
144 |
|
|
145 |
plot.setBackgroundPaint(null);
|
|
146 |
chart.setBackgroundPaint(Color.white);
|
|
145 |
chart.setBackgroundPaint(colorExternal); |
|
146 |
plot.setPaint(colorChart);
|
|
147 |
plot.setBackgroundPaint(colorBackground);
|
|
147 | 148 |
|
148 |
plot.setBackgroundPaint(new Color(245, 245, 245)); |
|
149 |
plot=null; |
|
150 | 149 |
|
151 | 150 |
} |
152 | 151 |
|
... | ... | |
154 | 153 |
/** |
155 | 154 |
* Actualizacion del panel que contiene el grafico |
156 | 155 |
* */ |
157 |
public void updateChartPanel(){ |
|
156 |
public void updateChartPanel(Color colorChart, Color colorbackground, Color colorExternal){ |
|
157 |
chart.setBackgroundPaint(colorExternal); |
|
158 |
plot.setPaint(colorChart); |
|
159 |
plot.setBackgroundPaint(colorbackground); |
|
158 | 160 |
jPanelChart.setChart(chart); |
159 | 161 |
// hace un clear cuando se cambian las bandas |
160 | 162 |
jPanelChart.getROIChartList().getListRois().clear(); |
... | ... | |
169 | 171 |
* seleccion de las bandas por parte del usuario. |
170 | 172 |
* |
171 | 173 |
* */ |
172 |
public void updateChart() { |
|
174 |
public void updateChart(Color colorChart, Color colorBackground, Color colorExternal) {
|
|
173 | 175 |
|
174 |
NumberAxis domainAxis = new NumberAxis(PluginServices.getText(this,"banda")+bandaX);
|
|
176 |
NumberAxis domainAxis = new NumberAxis(PluginServices.getText(this,"banda")+(bandaX+1));
|
|
175 | 177 |
domainAxis.setAutoRangeIncludesZero(false); |
176 |
NumberAxis rangeAxis = new NumberAxis(PluginServices.getText(this,"banda")+bandaY);
|
|
178 |
NumberAxis rangeAxis = new NumberAxis(PluginServices.getText(this,"banda")+(bandaY+1));
|
|
177 | 179 |
rangeAxis.setAutoRangeIncludesZero(false); |
178 | 180 |
chart=null; |
179 | 181 |
plot=null; |
... | ... | |
185 | 187 |
chart = new JFreeChart(PluginServices.getText(this,"diagrama_dispersion"), plot); |
186 | 188 |
chart.getRenderingHints().clear(); |
187 | 189 |
data=null; |
188 |
plot.setBackgroundPaint(null); |
|
189 |
chart.setBackgroundPaint(Color.white); |
|
190 |
|
|
191 |
plot.setBackgroundPaint(new Color(245, 245, 245)); |
|
192 |
plot=null; |
|
193 |
updateChartPanel(); |
|
190 |
updateChartPanel(colorChart,colorBackground,colorExternal); |
|
194 | 191 |
|
195 | 192 |
} |
196 | 193 |
|
... | ... | |
292 | 289 |
bandaX= band; |
293 | 290 |
} |
294 | 291 |
|
295 |
|
|
292 |
|
|
293 |
|
|
294 |
|
|
296 | 295 |
/** |
297 | 296 |
* Asignacion de la banda Y |
298 | 297 |
* */ |
Also available in: Unified diff