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

fixed some Sonar violations

parent 81d6aace
Branches
Tags
No related merge requests found
......@@ -130,15 +130,13 @@ public class AxisPair implements IChartPart {
protected static int getTickSpace(int workingSpace) {
int tickSpace = (int) (workingSpace * 0.95);
return tickSpace;
return (int) (workingSpace * 0.95);
}
protected static int getMargin(int workingSpace, int tickSpace) {
int marginSpace = workingSpace - tickSpace;
int margin = (int) (marginSpace / 2.0);
return margin;
return (int) (marginSpace / 2.0);
}
@Override
......
......@@ -18,6 +18,7 @@ package com.xeiam.xchart;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.imageio.ImageIO;
......@@ -27,13 +28,21 @@ import javax.imageio.ImageIO;
*/
public class BitmapEncoder {
/**
* Constructor - Private constructor to prevent instantiation
*/
private BitmapEncoder() {
}
/**
* Saves a chart as a PNG file
*
* @param chart
* @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);
Graphics2D lGraphics2D = lBufferedImage.createGraphics();
......
......@@ -17,6 +17,7 @@ package com.xeiam.xchart;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
......@@ -26,13 +27,21 @@ import javax.servlet.ServletOutputStream;
*/
public class ServletEncoder {
/**
* Constructor - Private constructor to prevent instantiation
*/
private ServletEncoder() {
}
/**
* Streams a chart as a PNG file
*
* @param out
* @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);
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