public void setRegion(String region) {
    this.currentRegion = region;
    renderer.setChartTitle(region);
    renderer.getSeriesRendererAt(0).setColor(colors[viewMode]);
    ((XYSeriesRenderer) renderer.getSeriesRendererAt(0))
        .setFillBelowLineColor(0x33000000 | colors[viewMode]);
    if (getComponentForm() != null) {

      XYMultiSeriesTransition t = new XYMultiSeriesTransition(chart, dataSet);
      RegionData[] rdArr = data.getRegionData(region);
      for (RegionData rd : rdArr) {
        switch (viewMode) {
          case VIEW_MODE_POPULATION:
            dataSet.getSeriesAt(0).setTitle("Population");
            t.getBuffer().getSeriesAt(POPULATION).add(rd.year, rd.pop);
            break;
          case VIEW_MODE_DENSITY:
            dataSet.getSeriesAt(0).setTitle("Density (People per square mile)");
            t.getBuffer().getSeriesAt(POPULATION).add(rd.year, rd.density);
            break;
          default:
            throw new RuntimeException("Illegal view mode.");
        }

        // t.getBuffer().getSeriesAt(DENSITY).add(rd.year, rd.density);
        // t.getBuffer().getSeriesAt(RANK).add(rd.year, rd.rank);
      }
      t.animateChart();
    } else {
      RegionData[] rdArr = data.getRegionData(region);
      renderer.getSeriesRendererAt(0).setColor(colors[viewMode]);
      for (RegionData rd : rdArr) {

        switch (viewMode) {
          case VIEW_MODE_POPULATION:
            dataSet.getSeriesAt(POPULATION).add(rd.year, rd.pop);
            dataSet.getSeriesAt(0).setTitle("Population");

            break;
          case VIEW_MODE_DENSITY:
            dataSet.getSeriesAt(0).setTitle("Density (People per square mile)");
            dataSet.getSeriesAt(POPULATION).add(rd.year, rd.density);
            break;
          default:
            throw new RuntimeException("Illegal view mode");
        }
      }
      Log.p("Finished adding pop data");
    }
  }
Esempio n. 2
0
 public void start() {
   if (current != null) {
     app.resume();
     current.show();
     return;
   }
   app = new CordovaApplication();
   app.addPlugin("Camera", new CameraPlugin());
   try {
     app.load("index.html");
   } catch (Exception ex) {
     Log.e(ex);
   }
   app.show();
 }
 protected void yearPressed(int year) {
   Log.p("Year pressed " + year);
 }
Esempio n. 4
0
 public void send(String values) {
   Log.p("Fallbacking to AnalyticsService");
   AnalyticsService.setAppsMode(true);
   AnalyticsService.init(trackingId, appName);
   AnalyticsService.visit(screenName, referrer);
 }