Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How to I use a ScrollBar object to control horizontal scrolling of the data in my chart?

0
Posted

How to I use a ScrollBar object to control horizontal scrolling of the data in my chart?

0

Since the ChartView class is derived from JPanel, you can place the scroll bar in the ChartView object, or you can place the ChartView object and the scroll bar in a parent container and use a layout manager to position everything. If you place the scroll bar in the ChartView you can still position it using a layout manager. The ChartView will always use the entire content area of the underlying JPanel for its canvas and the scroll bars will sit on top of this, not side by side. The example program swingexamples.LinePlotScrollBar uses two scroll bars, a horizontal scroll bar to control scrolling of the x-axis, and a vertical scroll bar that controls the magnitude of the y-axis. You need to implement the AdjustmentListener interface for the derived ChartView in order to process the adjustmentValueChanged method invoked when the scrollbars are moved. public void updateXScaleAndAxes(int index) { int startindex = 0; startindex = jScrollBar1.getValue(); pTransform1.setScaleStartX( (double)

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123