PageRenderTime 58ms CodeModel.GetById 12ms RepoModel.GetById 7ms app.codeStats 0ms

/src/main/java/com/atlassian/bamboo/plugin/dotnet/ncover/BuildSummaryCoverageLineChart.java

https://bitbucket.org/atlassian/bamboo-dotnet-plugin/
Java | 47 lines | 23 code | 6 blank | 18 comment | 0 complexity | 1b5c96187047aaa69ed26ebe2ed27ba8 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. package com.atlassian.bamboo.plugin.dotnet.ncover;
  2. import com.atlassian.bamboo.reports.charts.BambooReportLineChart;
  3. import com.atlassian.bamboo.util.NumberUtils;
  4. import org.jfree.chart.labels.XYToolTipGenerator;
  5. import org.jfree.data.time.TimePeriod;
  6. import org.jfree.data.time.TimeTableXYDataset;
  7. import org.jfree.data.xy.XYDataset;
  8. /**
  9. * {@link BambooReportLineChart} subclass that is used as part of displaying the line rate chart.
  10. *
  11. * @author Ross Rowe
  12. *
  13. */
  14. public class BuildSummaryCoverageLineChart extends BambooReportLineChart implements XYToolTipGenerator
  15. {
  16. /**
  17. * Constructs a new BuildSummaryCoverageLineChart instance.
  18. *
  19. */
  20. public BuildSummaryCoverageLineChart()
  21. {
  22. setyAxisLabel("% Line Rate");
  23. }
  24. /**
  25. * Generates the tool tip to show.
  26. *
  27. * @param xyDataset
  28. * @param series
  29. * @param item
  30. * @return the tool tip to show
  31. */
  32. @Override
  33. public String generateToolTip(XYDataset xyDataset, int series, int item)
  34. {
  35. TimeTableXYDataset dataset = (TimeTableXYDataset) xyDataset;
  36. double percentageCovered = dataset.getYValue(series, item);
  37. String buildKey = (String) dataset.getSeriesKey(series);
  38. TimePeriod timePeriod = dataset.getTimePeriod(item);
  39. return "Tests in " +timePeriod+ " covered " + NumberUtils.round(percentageCovered, 1) + "% of code in build " + buildKey;
  40. }
  41. }