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

Summary: Chart displayed incorrect after scrollPager.setDivisionRatio(n) // n != 3
Product: Java TeeChart Reporter: wangxing8192
Component: AndroidAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED WORKSFORME    
Severity: blocker CC: yeray
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: Phone   
OS: Android   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:
Attachments: add setDivisionRatio(4.0);

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);
    }
  }
}