Page 1 of 1
scrollpager
Posted: Fri Jul 19, 2013 5:32 am
by 17466268
In the ScrollPagerDemo code
the size [height] of the lower window is fixed.
Is it possible to adjust the height?
Also it seems the lower panel used to scroll is not using gridbag layouts so that when I resize the main window the lower panel is not resized automatically.
Is this true?
This cannot be used for commercial use without this feature [ autoresizing ]
Re: scrollpager
Posted: Fri Jul 19, 2013 1:57 pm
by yeray
Hi,
SetOnHi wrote:In the ScrollPagerDemo code
the size [height] of the lower window is fixed.
Is it possible to adjust the height?
You can use the divisionRatio for this. You can get it's value through getDivisionRatio() and you can set a new one through setDivisionRatio(double value). By default its value is 3. The height of the TSubChart below is the result of the division of the main chart height between this divisionRatio value.
SetOnHi wrote:Also it seems the lower panel used to scroll is not using gridbag layouts so that when I resize the main window the lower panel is not resized automatically.
Is this true?
This cannot be used for commercial use without this feature [ autoresizing ]
It seems to work fine for me. Look at the following screenshots:
- first.png (47.38 KiB) Viewed 12714 times
- second.png (47.65 KiB) Viewed 12711 times
- third.png (40.64 KiB) Viewed 12704 times
This is the code I used, with TeeChart Java SWT
Code: Select all
tChart1.getAspect().setView3D(false);
tChart1.getLegend().setVisible(false);
Line line1 = new Line(tChart1.getChart());
line1.fillSampleValues(100);
tChart1.setBounds(Utils.fromLTRB(0, 0, tChart1.getParent().getSize().x, tChart1.getParent().getSize().y-20));
ScrollPager scroPag1 = new ScrollPager(tChart1.getChart(), tChart1.getParent(), 0);
scroPag1.setSeries(line1);
Re: scrollpager
Posted: Thu Aug 01, 2013 5:52 am
by 17466268
I am afraid i am still having problems with resizing.
I didnt find your code worked but as your response was not a fully working app I may have missed something
I have attached a complete working eclipse project which is fairly closely based on the sample PageScroller.
if you start the application (GVApplication)
and then just maximize the window, the scrollpager is not resized.
I have tried all kinds of things including gridbags but I can't ever get the scrollpager to resize.
In addition to that the cursor tool invades the lower chart as I indicated in an earlier posting.
It may be related but I would really appreciate it if you not only take a look but reply with a working version.
I apologize if the error is mine but I am not convinced it is.
Re: scrollpager
Posted: Mon Aug 05, 2013 10:33 am
by yeray
Hello,
Note the ScrollPager tool is a bit special. As you'll see in the sources, this tool calculates both charts sizes and positions at the setUpChartLayout method, at ScrollPager.java.
To make the charts to resize with the application, you just have to do the same at your componentResized event. At GVScrollPager.java:
Code: Select all
public GVScrollPager()
{
super();
addComponentListener(new java.awt.event.ComponentAdapter()
{
public void componentResized(java.awt.event.ComponentEvent evt)
{
scrollPagerDemoResized(evt);
System.out.println("*********** " + evt.paramString());
java.awt.Dimension d = GVFrame.contentPane.getSize();
setSize(d);
setPreferredSize(d);
//chart1.setBounds(Utils.fromLTRB(0, 0, (int)chart1.getParent().getSize().getWidth(), (int)chart1.getParent().getSize().getHeight()-20));
setUpChartLayout();
}
});
last3XClicks[0] = 0;
last3XClicks[1] = 0;
last3XClicks[2] = 0;
last3YClicks[0] = 0;
last3YClicks[1] = 0;
last3YClicks[2] = 0;
}
private void setUpChartLayout() {
int width = Math.max(chart1.getChart().getParent().getControlWidth(), chart1.getChart().getWidth());
int height = Math.max(chart1.getChart().getParent().getControlHeight(), chart1.getChart().getHeight());
tool1.getSubChartTChart().getAspect().setView3D(false);
tool1.getSubChartTChart().setWidth(width);
tool1.getSubChartTChart().setHeight(Utils.round(height / tool1.getDivisionRatio()));
int top = height - tool1.getSubChartTool().getCharts().get(0).getHeight();
tool1.getSubChartTool().getCharts().get(0).setLeft(0);
tool1.getSubChartTool().getCharts().get(0).setTop(top);
chart1.getChart().setCustomChartRect(true);
Rectangle rect = Utils.fromLTRB(0, 10, tool1.getSubChartTChart().getWidth() - 20, tool1.getSubChartTChart().getY());
chart1.getChart().setChartRect(rect);
tool1.getSubChartTChart().getPanel().setMarginUnits(PanelMarginUnits.PIXELS);
tool1.getSubChartTChart().getPanel().setMarginRight(width - chart1.getChart().getChartRect().getRight());
tool1.getSubChartTChart().getPanel().setMarginBottom(5);
}
And regarding the Cursor tool clipping, take a look at the discussion here:
http://www.teechart.net/support/viewtop ... 10&t=12211
Re: scrollpager
Posted: Tue Aug 06, 2013 7:57 pm
by 17466268
Thats perfect
Thank you for you excellent support
Really appreciated.