File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 2020 yaxis : { zoomRange : null , panRange : null } ,
2121 xaxis : { zoomRange : null , panRange : null } ,
2222 zoom : { interactive : true } ,
23- pan : { interactive : true }
23+ pan : { interactive : true } ,
24+ legend : { show : true }
2425 } ;
2526 $ . plot ( $ ( "#chart" ) , d , options ) ;
2627 }
27- function addSeries ( theSeries )
28+ function addSeries ( theSeries , theBand , theColor )
2829 {
29- d . push ( { data : theSeries } ) ;
30+ d . push ( { data : theSeries , label : "Band " + theBand , color : theColor } ) ;
3031 replot ( ) ;
3132 //alert( theSeries );
3233 }
Original file line number Diff line number Diff line change @@ -1884,7 +1884,10 @@ void QgsRasterLayerProperties::refreshHistogram()
18841884 //
18851885 // now draw actual graphs
18861886 //
1887-
1887+ int myRedBand = mRasterLayer ->bandNumber ( cboRed->currentText () );
1888+ int myGreenBand = mRasterLayer ->bandNumber ( cboGreen->currentText () );
1889+ int myBlueBand = mRasterLayer ->bandNumber ( cboBlue->currentText () );
1890+ int myGrayBand = mRasterLayer ->bandNumber ( cboGray->currentText () );
18881891 for ( int myIteratorInt = 1 ;
18891892 myIteratorInt <= myBandCountInt;
18901893 ++myIteratorInt )
@@ -1903,7 +1906,18 @@ void QgsRasterLayerProperties::refreshHistogram()
19031906 mySeriesJS += QString (" [%1,%2]" ).arg (myBin).arg (myBinValue);
19041907 myFirst = false ;
19051908 }
1906- mySeriesJS += " ]);" ;
1909+ QString myColor = " " ;
1910+ if ( myIteratorInt == myRedBand )
1911+ myColor = " #FF0000" ;
1912+ else if ( myIteratorInt == myGreenBand )
1913+ myColor = " #00FF00" ;
1914+ else if ( myIteratorInt == myBlueBand )
1915+ myColor = " #0000FF" ;
1916+ else if ( myIteratorInt == myGrayBand )
1917+ myColor = " #FCFCFC" ;
1918+ else
1919+ myColor = " #F0C1D1" ;
1920+ mySeriesJS += QString (" ], %1, '%2');" ).arg (myIteratorInt).arg ( myColor );
19071921 // QgsDebugMsg( mySeriesJS );
19081922 mWebPlot ->page ()->mainFrame ()->evaluateJavaScript ( mySeriesJS );
19091923 }
You can’t perform that action at this time.
0 commit comments