morechart.chart.ZoomableChartPanel.scala Maven / Gradle / Ivy
package morechart.chart
import java.awt.event. { MouseWheelEvent, MouseWheelListener }
import org.jfree.chart.ChartPanel
/** Extends [[org.jfree.chart.ChartPanel]] with x and y zoom.
*
* @author myst3r10n
*/
trait ZoomableChartPanel extends ChartPanel {
addMouseWheelListener(new MouseWheelListener {
def mouseWheelMoved(event: MouseWheelEvent) {
if(event.getUnitsToScroll < 0)
zoomInBoth(event.getUnitsToScroll, event.getUnitsToScroll)
else if(event.getUnitsToScroll > 0)
zoomOutBoth(event.getUnitsToScroll, event.getUnitsToScroll)
}
} )
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy