Package com.gitblit.wicket.charting

Examples of com.gitblit.wicket.charting.Flotr2Charts


    return getString("gb.summary");
  }

  private Charts createCharts(List<Metric> metrics) {

    Charts charts = new Flotr2Charts();

    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    String displayFormat = "MMM dd";
    if(metrics.size() > 0 && metrics.get(0).name.length() == 7){
      df = new SimpleDateFormat("yyyy-MM");
      displayFormat = "yyyy MMM";
    }
    df.setTimeZone(getTimeZone());

    // build google charts
    Chart chart = charts.createLineChart("commitsChart", getString("gb.activity"), "day", getString("gb.commits"));
    chart.setDateFormat(displayFormat);

    for (Metric metric : metrics) {
      Date date;
      try {
        date = df.parse(metric.name);
      } catch (ParseException e) {
        logger.error("Unable to parse date: " + metric.name);
        return charts;
      }
      chart.addValue(date, (int)metric.count);
      if(metric.tag > 0 ){
        chart.addHighlight(date, (int)metric.count);
      }
    }
    charts.addChart(chart);

    return charts;
  }
View Full Code Here


        repositoryMetrics.get(repository).count += entry.getValue().count;
      }
    }

    // build charts
    Charts charts = new Flotr2Charts();

    // sort in reverse-chronological order and then reverse that
    Collections.sort(recentActivity);
    Collections.reverse(recentActivity);

    // daily line chart
    Chart chart = charts.createLineChart("chartDaily", getString("gb.dailyActivity"), "day",
        getString("gb.commits"));
    SimpleDateFormat df = new SimpleDateFormat("MMM dd");
    df.setTimeZone(getTimeZone());
    for (Activity metric : recentActivity) {
      chart.addValue(metric.startDate, metric.getCommitCount());
    }
    charts.addChart(chart);

    // active repositories pie chart
    chart = charts.createPieChart("chartRepositories", getString("gb.activeRepositories"),
        getString("gb.repository"), getString("gb.commits"));
    for (Metric metric : repositoryMetrics.values()) {
      chart.addValue(metric.name, metric.count);
    }
    chart.setShowLegend(false);
    String url = urlFor(SummaryPage.class, null).toString() + "?r=";
    chart.setClickUrl(url);
    charts.addChart(chart);

    // active authors pie chart
    chart = charts.createPieChart("chartAuthors", getString("gb.activeAuthors"),
        getString("gb.author"), getString("gb.commits"));
    for (Metric metric : authorMetrics.values()) {
      chart.addValue(metric.name, metric.count);
    }
    chart.setShowLegend(false);
    charts.addChart(chart);

    return charts;
  }
View Full Code Here

    frag.add(new Label("feedheader", MessageFormat.format(headerPattern,
        daysBack, totalCommits, authorMetrics.size())));

    if (app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {
      // build google charts
      Charts charts = new Flotr2Charts();

      // active repositories pie chart
      Chart chart = charts.createPieChart("chartRepositories", getString("gb.activeRepositories"),
          getString("gb.repository"), getString("gb.commits"));
      for (Metric metric : repositoryMetrics.values()) {
        chart.addValue(metric.name, metric.count);
      }
      chart.setShowLegend(false);
      String url = urlFor(SummaryPage.class, null).toString() + "?r=";
      chart.setClickUrl(url);
      charts.addChart(chart);

      // active authors pie chart
      chart = charts.createPieChart("chartAuthors", getString("gb.activeAuthors"),
          getString("gb.author"), getString("gb.commits"));
      for (Metric metric : authorMetrics.values()) {
        chart.addValue(metric.name, metric.count);
      }
      chart.setShowLegend(false);
      charts.addChart(chart);

      add(new HeaderContributor(charts));
      frag.add(new Fragment("charts", "chartsFragment", this));
    } else {
      frag.add(new Label("charts").setVisible(false));
View Full Code Here

      add(new Label("branchStats",
          MessageFormat.format(getString("gb.branchStats"), metricsTotal.count,
              metricsTotal.tag, getTimeUtils().duration(metricsTotal.duration))));
    }
   
    Charts charts =  new Flotr2Charts();
 
    add(WicketUtils.newBlankImage("commitsChart"));
    add(WicketUtils.newBlankImage("dayOfWeekChart"));
    add(WicketUtils.newBlankImage("authorsChart"));
     
View Full Code Here

    return getString("gb.summary");
  }

  private Charts createCharts(List<Metric> metrics) {

    Charts charts = new Flotr2Charts();

    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    String displayFormat = "MMM dd";
    if(metrics.size() > 0 && metrics.get(0).name.length() == 7){
      df = new SimpleDateFormat("yyyy-MM");
      displayFormat = "yyyy MMM";
    }
    df.setTimeZone(getTimeZone());

    // build google charts
    Chart chart = charts.createLineChart("commitsChart", getString("gb.activity"), "day", getString("gb.commits"));
    chart.setDateFormat(displayFormat);

    for (Metric metric : metrics) {
      Date date;
      try {
        date = df.parse(metric.name);
      } catch (ParseException e) {
        logger.error("Unable to parse date: " + metric.name);
        return charts;
      }
      chart.addValue(date, (int)metric.count);
      if(metric.tag > 0 ){
        chart.addHighlight(date, (int)metric.count);
      }
    }
    charts.addChart(chart);

    return charts;
  }
View Full Code Here

      add(new Label("branchStats",
          MessageFormat.format(getString("gb.branchStats"), metricsTotal.count,
              metricsTotal.tag, getTimeUtils().duration(metricsTotal.duration))));
    }

    Charts charts =  new Flotr2Charts();

    add(WicketUtils.newBlankImage("commitsChart"));
    add(WicketUtils.newBlankImage("dayOfWeekChart"));
    add(WicketUtils.newBlankImage("authorsChart"));
View Full Code Here

        repositoryMetrics.get(repository).count += entry.getValue().count;
      }
    }

    // build charts
    Charts charts = new Flotr2Charts();

    // sort in reverse-chronological order and then reverse that
    Collections.sort(recentActivity);
    Collections.reverse(recentActivity);

    // daily line chart
    Chart chart = charts.createLineChart("chartDaily", getString("gb.dailyActivity"), "day",
        getString("gb.commits"));
    SimpleDateFormat df = new SimpleDateFormat("MMM dd");
    df.setTimeZone(getTimeZone());
    for (Activity metric : recentActivity) {
      chart.addValue(metric.startDate, metric.getCommitCount());
    }
    charts.addChart(chart);

    // active repositories pie chart
    chart = charts.createPieChart("chartRepositories", getString("gb.activeRepositories"),
        getString("gb.repository"), getString("gb.commits"));
    for (Metric metric : repositoryMetrics.values()) {
      chart.addValue(metric.name, metric.count);
    }
    chart.setShowLegend(false);
    String url = urlFor(SummaryPage.class, null).toString() + "?r=";
    chart.setClickUrl(url);
    charts.addChart(chart);

    // active authors pie chart
    chart = charts.createPieChart("chartAuthors", getString("gb.activeAuthors"),
        getString("gb.author"), getString("gb.commits"));
    for (Metric metric : authorMetrics.values()) {
      chart.addValue(metric.name, metric.count);
    }
    chart.setShowLegend(false);
    charts.addChart(chart);

    return charts;
  }
View Full Code Here

  private void insertActivityGraph(List<Metric> metrics) {
    if ((metrics != null) && (metrics.size() > 0)
        && app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {

      Charts charts = new Flotr2Charts();
     
      // daily line chart
      Chart chart = charts.createLineChart("chartDaily", "", "unit",
          getString("gb.commits"));
      for (Metric metric : metrics) {
        chart.addValue(metric.name, metric.count);
      }
      chart.setWidth(375);
      chart.setHeight(150);

      charts.addChart(chart);
      add(new HeaderContributor(charts));
    }
  }
View Full Code Here

    frag.add(new Label("feedheader", MessageFormat.format(headerPattern,
        daysBack, totalCommits, authorMetrics.size())));

    if (app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {
      // build google charts
      Charts charts = new Flotr2Charts();

      // active repositories pie chart
      Chart chart = charts.createPieChart("chartRepositories", getString("gb.activeRepositories"),
          getString("gb.repository"), getString("gb.commits"));
      for (Metric metric : repositoryMetrics.values()) {
        chart.addValue(metric.name, metric.count);
      }
      chart.setShowLegend(false);
      String url = urlFor(SummaryPage.class, null).toString() + "?r=";
      chart.setClickUrl(url);
      charts.addChart(chart);

      // active authors pie chart
      chart = charts.createPieChart("chartAuthors", getString("gb.activeAuthors"),
          getString("gb.author"), getString("gb.commits"));
      for (Metric metric : authorMetrics.values()) {
        chart.addValue(metric.name, metric.count);
      }
      chart.setShowLegend(false);
      charts.addChart(chart);

      add(new HeaderContributor(charts));
      frag.add(new Fragment("charts", "chartsFragment", this));
    } else {
      frag.add(new Label("charts").setVisible(false));
View Full Code Here

TOP

Related Classes of com.gitblit.wicket.charting.Flotr2Charts

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.