Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 497 - Chart displayed incorrect after scrollPager.setDivisionRatio(n) // n != 3
Summary: Chart displayed incorrect after scrollPager.setDivisionRatio(n) // n != 3
Status: RESOLVED WORKSFORME
Alias: None
Product: Java TeeChart
Classification: Unclassified
Component: Android (show other bugs)
Version: unspecified
Hardware: Phone Android
: --- blocker
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-03 13:52 EST by wangxing8192
Modified: 2013-12-13 10:55 EST (History)
1 user (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments
add setDivisionRatio(4.0); (116.54 KB, image/png)
2013-12-03 13:52 EST, wangxing8192
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wangxing8192 2013-12-03 13:52:42 EST
Created attachment 41 [details]
add setDivisionRatio(4.0);

## Description
For Android platform, scrollPager.setDivisionRatio(n) cannot modify the height of the sub chart.
After set division ratio, it seems that the main chart changed size, but the sub chart didn't, and there was only apart of sub chart could be rendered (because the height of whole view is fixed ?) 

## Re-present:
In the Android demo application, modify:
com.steema.teechart.android.ChartView.java: line 877

replace
    new ScrollPager(chart.getChart(), this);
with
    new ScrollPager(chart.getChart(), this).setDivisionRatio(4.0);

Then run the modified demo --> Play TeeChart --> Tools --> Scroll Pager


## Please response quickly
Comment 1 yeray alonso 2013-12-13 10:55:06 EST
In the same example you mention, just after the line you modified I can read:

// The ScrollPager tool needs the chart to be drawn to calculate the
// SubChart size
// that's why we call setSeries at the chartPainted event.

This means any modification affecting the ScrollPager layout needs to be placed into the chartPainted event.
Adding s.setDivisionRatio(4.0); at the end of the code in the event, still inside the "if (s.getSeries() == null)", it seems to work as expected for me here:
Here is the complete event:

@Override
public void chartPainted(ChartDrawEvent e) {
  if (chart.getTools().getTool(0).getClass() == ScrollPager.class) {
    ScrollPager s = (ScrollPager)chart.getTools().getTool(0);
    if (s.getSeries() == null) {
      s.setSeries(chart.getSeries(0));
      TChart scrollPagerChart = s.getSubChartTChart();
      if (extras.getBoolean("ThemeSelected", true)) {
        ThemesList.applyTheme(scrollPagerChart.getChart(), extras.getInt("numThemeSelected"));
      } else {
        ThemesList.applyTheme(scrollPagerChart.getChart(), 1);
      }
      s.setDivisionRatio(4.0);
    }
  }
}