Skip to content
Snippets Groups Projects
Commit 6b1dd633 authored by timmolter's avatar timmolter
Browse files

fixed some Sonar violations

parent 81d6aace
No related branches found
No related tags found
No related merge requests found
...@@ -130,15 +130,13 @@ public class AxisPair implements IChartPart { ...@@ -130,15 +130,13 @@ public class AxisPair implements IChartPart {
protected static int getTickSpace(int workingSpace) { protected static int getTickSpace(int workingSpace) {
int tickSpace = (int) (workingSpace * 0.95); return (int) (workingSpace * 0.95);
return tickSpace;
} }
protected static int getMargin(int workingSpace, int tickSpace) { protected static int getMargin(int workingSpace, int tickSpace) {
int marginSpace = workingSpace - tickSpace; int marginSpace = workingSpace - tickSpace;
int margin = (int) (marginSpace / 2.0); return (int) (marginSpace / 2.0);
return margin;
} }
@Override @Override
......
...@@ -18,6 +18,7 @@ package com.xeiam.xchart; ...@@ -18,6 +18,7 @@ package com.xeiam.xchart;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
...@@ -27,13 +28,21 @@ import javax.imageio.ImageIO; ...@@ -27,13 +28,21 @@ import javax.imageio.ImageIO;
*/ */
public class BitmapEncoder { public class BitmapEncoder {
/**
* Constructor - Private constructor to prevent instantiation
*/
private BitmapEncoder() {
}
/** /**
* Saves a chart as a PNG file * Saves a chart as a PNG file
* *
* @param chart * @param chart
* @param pFileName * @param pFileName
* @throws IOException
*/ */
public static void savePNG(Chart chart, String pFileName) throws Exception { public static void savePNG(Chart chart, String pFileName) throws IOException {
BufferedImage lBufferedImage = new BufferedImage(chart.width, chart.height, BufferedImage.TYPE_INT_RGB); BufferedImage lBufferedImage = new BufferedImage(chart.width, chart.height, BufferedImage.TYPE_INT_RGB);
Graphics2D lGraphics2D = lBufferedImage.createGraphics(); Graphics2D lGraphics2D = lBufferedImage.createGraphics();
......
...@@ -17,6 +17,7 @@ package com.xeiam.xchart; ...@@ -17,6 +17,7 @@ package com.xeiam.xchart;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
...@@ -26,13 +27,21 @@ import javax.servlet.ServletOutputStream; ...@@ -26,13 +27,21 @@ import javax.servlet.ServletOutputStream;
*/ */
public class ServletEncoder { public class ServletEncoder {
/**
* Constructor - Private constructor to prevent instantiation
*/
private ServletEncoder() {
}
/** /**
* Streams a chart as a PNG file * Streams a chart as a PNG file
* *
* @param out * @param out
* @param chart * @param chart
* @throws IOException
*/ */
public static void streamPNG(ServletOutputStream out, Chart chart) throws Exception { public static void streamPNG(ServletOutputStream out, Chart chart) throws IOException {
BufferedImage lBufferedImage = new BufferedImage(chart.width, chart.height, BufferedImage.TYPE_INT_RGB); BufferedImage lBufferedImage = new BufferedImage(chart.width, chart.height, BufferedImage.TYPE_INT_RGB);
Graphics2D lGraphics2D = lBufferedImage.createGraphics(); Graphics2D lGraphics2D = lBufferedImage.createGraphics();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment