aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-plugin/src
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-10-24 10:19:30 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-10-24 10:25:12 +0200
commit27181666ce43e0e54b178b731a3480e655ad87b4 (patch)
tree067dd3623d692bab9987d25c4053fd0b3f89fd1e /plugins/sonar-core-plugin/src
parent545887882d1bba374d91d733badc03033d4ee331 (diff)
downloadsonarqube-27181666ce43e0e54b178b731a3480e655ad87b4.tar.gz
sonarqube-27181666ce43e0e54b178b731a3480e655ad87b4.zip
SONAR-5582 remove XRadar chart
Diffstat (limited to 'plugins/sonar-core-plugin/src')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java2
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/XradarChart.java87
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/XradarChartTest.java49
3 files changed, 0 insertions, 138 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
index 81326ff34b7..fc1d540c4aa 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
@@ -30,7 +30,6 @@ import org.sonar.core.timemachine.Periods;
import org.sonar.plugins.core.batch.IndexProjectPostJob;
import org.sonar.plugins.core.charts.DistributionAreaChart;
import org.sonar.plugins.core.charts.DistributionBarChart;
-import org.sonar.plugins.core.charts.XradarChart;
import org.sonar.plugins.core.colorizers.JavaColorizerFormat;
import org.sonar.plugins.core.dashboards.GlobalDefaultDashboard;
import org.sonar.plugins.core.dashboards.ProjectDefaultDashboard;
@@ -328,7 +327,6 @@ public final class CorePlugin extends SonarPlugin {
GlobalDefaultDashboard.class,
// chart
- XradarChart.class,
DistributionBarChart.class,
DistributionAreaChart.class,
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/XradarChart.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/XradarChart.java
deleted file mode 100644
index 41a80bd53e4..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/XradarChart.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.core.charts;
-
-import org.apache.commons.lang.StringUtils;
-import org.jfree.chart.plot.Plot;
-import org.jfree.chart.plot.SpiderWebPlot;
-import org.jfree.data.category.CategoryDataset;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.sonar.api.charts.AbstractChart;
-import org.sonar.api.charts.ChartParameters;
-
-import java.awt.*;
-
-public class XradarChart extends AbstractChart {
-
- /**
- * see an example of complete URL in XradarChartTest
- */
-
- public static final String PARAM_COLOR = "c";
- public static final String PARAM_MAX_VALUE = "m";
- public static final String PARAM_INTERIOR_GAP = "g";
- public static final String PARAM_LABELS = "l";
- public static final String PARAM_VALUES = "v";
-
- @Override
- public String getKey() {
- return "xradar";
- }
-
- @Override
- protected Plot getPlot(ChartParameters params) {
- SpiderWebPlot plot = new SpiderWebPlot(createDataset(params));
- plot.setStartAngle(0D);
- plot.setOutlineVisible(false);
- plot.setAxisLinePaint(Color.decode("0xCCCCCC"));
- plot.setSeriesOutlineStroke(new BasicStroke(2f));
-
- if (params.getValue(PARAM_INTERIOR_GAP) != null) {
- plot.setInteriorGap(Double.parseDouble(params.getValue(PARAM_INTERIOR_GAP, "0.4", false)));
- }
- if (params.getValue(PARAM_MAX_VALUE) != null) {
- plot.setMaxValue(Double.parseDouble(params.getValue(PARAM_MAX_VALUE, "100", false)));
- }
- configureColors(plot, params);
- return plot;
- }
-
- private void configureColors(SpiderWebPlot plot, ChartParameters params) {
- String[] colors = params.getValues(PARAM_COLOR, "|");
- for (int i = 0; i < colors.length; i++) {
- plot.setSeriesPaint(i, Color.decode("0x" + colors[i]));
- }
- }
-
- private CategoryDataset createDataset(ChartParameters params) {
- String[] labels = params.getValues(PARAM_LABELS, ",");
- String[] values = params.getValues(PARAM_VALUES, "|");
-
- DefaultCategoryDataset set = new DefaultCategoryDataset();
- for (int indexValues = 0; indexValues < values.length; indexValues++) {
- String[] fields = StringUtils.split(values[indexValues], ",");
- for (int i = 0; i < fields.length; i++) {
- set.addValue(Double.parseDouble(fields[i]), "" + indexValues, labels[i]);
- }
- }
- return set;
- }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/XradarChartTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/XradarChartTest.java
deleted file mode 100644
index d48d049c440..00000000000
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/charts/XradarChartTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.plugins.core.charts;
-
-import org.junit.Test;
-import org.sonar.api.charts.ChartParameters;
-
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-
-public class XradarChartTest extends AbstractChartTest {
-
- @Test
- public void shouldGenerateXradar() throws IOException {
- String url = "w=200&h=200&l=Usa.,Eff.,Rel.,Main.,Por.&g=0.25&m=100&v=90,80,70,60,50|40,30,20,10,10&c=CAE3F2|F8A036";
- XradarChart radar = new XradarChart();
- BufferedImage img = radar.generateImage(new ChartParameters(url));
- saveChart(img, "shouldGenerateXradar.png");
- assertChartSizeGreaterThan(img, 50);
- }
-
- @Test
- public void negativeValuesAreNotDisplayed() throws IOException {
- String url = "w=200&h=200&l=Usa.,Eff.,Rel.,Main.,Por.&g=0.3&m=100&v=-90,-80,70,60,50&c=CAE3F2";
- XradarChart radar = new XradarChart();
- BufferedImage img = radar.generateImage(new ChartParameters(url));
- saveChart(img, "negativeValuesAreNotDisplayed.png");
-
- // you have to check visually that it does not work ! Min value is 0. This is a limitation of JFreeChart.
- assertChartSizeGreaterThan(img, 50);
- }
-}