Skip to content
Snippets Groups Projects
Commit 7ace5399 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Vertical and horizontal spider chart legend working properly.

refs 2589
parent 8dcb1ddd
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.fortiss.tooling.spiderchart.gc.AbstractChartImage;
import org.fortiss.tooling.spiderchart.gc.swt.SpiderChartSwtGraphics;
......@@ -37,6 +38,8 @@ import org.fortiss.tooling.spiderchart.label.SpiderChartLabel;
import org.fortiss.tooling.spiderchart.label.api.IFloatingObject;
import org.fortiss.tooling.spiderchart.listener.ISpiderChartListener;
import org.fortiss.tooling.spiderchart.model.DataSeries;
import org.fortiss.tooling.spiderchart.model.SpiderChart;
import org.fortiss.tooling.spiderchart.plotter.SpiderChartComponentBase;
import org.fortiss.tooling.spiderchart.plotter.SpiderChartLegend;
import org.fortiss.tooling.spiderchart.plotter.SpiderChartPlotter;
import org.fortiss.tooling.spiderchart.plotter.SpiderChartTitle;
......@@ -48,11 +51,16 @@ import org.fortiss.tooling.spiderchart.style.LineStyle;
* Actual Spider Chart Diagram
*
* @author mondal
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 13207B1B51F8F60D2122999D2EDB0603
*/
public final class SpiderChartOld {
public final class SpiderChartOld extends SpiderChartComponentBase {
/** Margin for the spider chart from all sides. */
private static final double MARGIN_PERCENT = 0.125;
/** Margin for axes. */
private static final double AXIS_MARGIN = MARGIN_PERCENT / 2.0;
/** the localized string for numbers */
private static String numberLocale;
......@@ -70,9 +78,6 @@ public final class SpiderChartOld {
/** The flag to be used to enable selection of data points */
private boolean activateSelection = false;
/** Axis Margin */
private double axisMargin = 0.0625D;
/** Background Canvas Color */
private int swtBackgroundCanvasColor = SWT.COLOR_GRAY;
......@@ -85,9 +90,6 @@ public final class SpiderChartOld {
/** Border Style */
private LineStyle border = null;
/** Margin from the bottom */
private final double bottomMargin = 0.125D;
/** Spider Chart Image */
private AbstractChartImage chartImage = null;
......@@ -115,24 +117,9 @@ public final class SpiderChartOld {
/** configuration if X-Axis Screen Margin will be set */
private final boolean fullXAxis = false;
/** Height of the spider chart */
private int height = 0;
/** last height before the zoom */
private int lastHeight = -1;
/** last height before the width */
private int lastWidth = -1;
/** Chart Left Margin */
private final double leftMargin = 0.125D;
/** Spider Chart Legend */
private SpiderChartLegend legend;
/** Spider Chart Legend Margin */
private final double legendMargin = 0.2D;
/** minimum height */
private int minimumHeight = 0;
......@@ -148,18 +135,9 @@ public final class SpiderChartOld {
/** Y-offset for data points */
private int offsetY = 0;
/** */
private int originalVirtualHeight = -1;
/** */
private int originalVirtualWidth = -1;
/** The plotters to be used for spider chart plotting. */
private SpiderChartPlotter plotter;
/** Right Margin */
private final double rightMargin = 0.125D;
/** Spider Chart Label */
private SpiderChartLabel selectedLabel = null;
......@@ -187,20 +165,9 @@ public final class SpiderChartOld {
/** Spider Chart Title */
private SpiderChartTitle title;
/** Top Margin */
private final double topMargin = 0.125D;
/** */
private int virtualHeight = 0;
/** */
private int virtualWidth = 0;
/** Width of the chart */
private int width = 0;
/** Constructor */
public SpiderChartOld(final SpiderChartTitle t, final SpiderChartPlotter p) {
public SpiderChartOld(SpiderChart chart, SpiderChartTitle t, SpiderChartPlotter p) {
super(chart);
this.resetChart(t, p);
}
......@@ -240,11 +207,6 @@ public final class SpiderChartOld {
}
}
/** Getter for Axis Margin */
public double getAxisMargin() {
return this.axisMargin;
}
/** Getter for Background Canvas Color */
public Color getBackgroundCanvasColor() {
return Display.getCurrent().getSystemColor(swtBackgroundCanvasColor);
......@@ -265,11 +227,6 @@ public final class SpiderChartOld {
return this.border;
}
/** Getter for Bottom Margin */
public double getBottomMargin() {
return this.bottomMargin;
}
/** Getter for Chart Image */
public AbstractChartImage getChartImage() {
return this.chartImage;
......@@ -310,36 +267,11 @@ public final class SpiderChartOld {
return this.floatingObjects;
}
/** Getter for the height */
public int getHeight() {
return this.height;
}
/** Getter for last height of the chart before zoom */
public int getLastHeight() {
return this.lastHeight;
}
/** Getter for the last width of the chart before zoom */
public int getLastWidth() {
return this.lastWidth;
}
/** Getter for left margin */
public double getLeftMargin() {
return this.leftMargin;
}
/** Getter for the spider chart legend */
public SpiderChartLegend getLegend() {
return this.legend;
}
/** Getter for legend margin */
public double getLegendMargin() {
return this.legendMargin;
}
/** Getter for minimum height */
public int getMinimumHeight() {
return this.minimumHeight;
......@@ -365,26 +297,11 @@ public final class SpiderChartOld {
return this.offsetY;
}
/** Getter for virtual height */
public int getOriginalVirtualHeight() {
return this.originalVirtualHeight;
}
/** Getter for virtual width */
public int getOriginalVirtualWidth() {
return this.originalVirtualWidth;
}
/** Returns the plotter. */
public SpiderChartPlotter getPlotter() {
return plotter;
}
/** Getter for margin from right */
public double getRightMargin() {
return this.rightMargin;
}
/** Getter for spider chart label */
public SpiderChartLabel getSelectedLabel() {
return this.selectedLabel;
......@@ -402,8 +319,7 @@ public final class SpiderChartOld {
/** Getter for the first plotter to be used */
public SpiderChartPlotter getSpiderPlotter() {
// FIXME: wild cast
return (SpiderChartPlotter)plotter;
return plotter;
}
/** Getter for the tip color */
......@@ -426,26 +342,6 @@ public final class SpiderChartOld {
return this.title;
}
/** Getter for the margin from top */
public double getTopMargin() {
return this.topMargin;
}
/** Getter for virtual height */
public int getVirtualHeight() {
return this.virtualHeight;
}
/** Getter for virtual width */
public int getVirtualWidth() {
return this.virtualWidth;
}
/** Getter for the width of the chart */
public int getWidth() {
return this.width;
}
/**
* Getter for the configuration to check if it is a active sequence
* selection
......@@ -547,8 +443,6 @@ public final class SpiderChartOld {
return;
}
resize();
if(plotter != null) {
plotter.plotBackground(graphics);
plotter.drawAxes(graphics);
......@@ -571,16 +465,6 @@ public final class SpiderChartOld {
SpiderChartSwtGraphics gScroll = graphics;
SpiderChartSwtGraphics gBack = graphics;
SpiderChartSwtGraphics g = graphics;
if(this.lastWidth != this.width || this.lastHeight != this.height) {
this.lastWidth = this.width;
this.lastHeight = this.height;
}
if(this.originalVirtualHeight == -1) {
this.originalVirtualHeight = this.virtualHeight;
}
if(this.originalVirtualWidth == -1) {
this.originalVirtualWidth = this.virtualWidth;
}
if(this.finalImage != null) {
this.finalImage.dispose();
}
......@@ -589,8 +473,7 @@ public final class SpiderChartOld {
gScroll = g;
gBack = g;
if(this.backStyle != null) {
this.backStyle.draw(gBack, getBackgroundCanvasColor(), 0, 0, this.virtualWidth,
this.virtualHeight);
this.backStyle.draw(gBack, getBackgroundCanvasColor(), 0, 0, getWidth(), getHeight());
}
// FIXME: scale feature disabled
// if(plotter.getxScale() != null) {
......@@ -615,9 +498,9 @@ public final class SpiderChartOld {
}
if(this.chartImage != null) {
final int x1 = plotter.getX();
final int x2 = plotter.getX() + plotter.getVisibleWidth();
final int x2 = plotter.getX() + plotter.getWidth();
final int y1 = plotter.getY() - plotter.getDepth();
final int y2 = plotter.getY() - plotter.getDepth() + plotter.getVisibleHeight();
final int y2 = plotter.getY() - plotter.getDepth() + plotter.getHeight();
g.drawImage(this.chartImage, x1, y1, x2, y2, x1 + this.offsetX, y1 + this.offsetY, x2 +
this.offsetX, y2 + this.offsetY);
......@@ -677,32 +560,34 @@ public final class SpiderChartOld {
}
/** Resizes the chart */
private void resize() {
final int myHeight = this.getHeight();
final int myWidth = this.getWidth();
if(this.virtualWidth < myWidth) {
this.virtualWidth = myWidth;
}
if(this.virtualHeight < myHeight) {
this.virtualHeight = myHeight;
}
plotter.setVisibleWidth((int)(myWidth * (1.0D - (this.legendMargin + this.leftMargin))));
plotter.setVisibleHeight((int)(myHeight * (1.0D - (this.topMargin + this.bottomMargin))));
plotter.setX((int)(myWidth * this.leftMargin));
plotter.setY((int)(myHeight * this.topMargin));
plotter.setWidth(this.virtualWidth - (myWidth - plotter.getVisibleWidth()));
plotter.setHeight(this.virtualHeight - (myHeight - plotter.getVisibleHeight()));
this.title.setX(0);
this.title.setY(0);
this.title.setHeight((int)(myHeight * this.topMargin));
this.title.setWidth(myWidth);
if(this.legend != null) {
this.legend.setX((int)(myWidth * (1.0D - this.legendMargin)));
this.legend.setY((int)(myHeight * this.topMargin));
this.legend.setWidth((int)(myWidth * this.legendMargin));
this.legend.setHeight((int)(myHeight * 0.5D));
public void layoutChartComponents() {
int width = getWidth();
int widthMargin = (int)(width * MARGIN_PERCENT);
int height = getHeight();
int heightMargin = (int)(height * MARGIN_PERCENT);
plotter.setX(widthMargin);
plotter.setWidth(width - 2 * widthMargin - 1);
plotter.setY(heightMargin);
plotter.setHeight(height - 2 * heightMargin - 1);
title.setX(0);
title.setY(0);
title.setHeight(heightMargin - 1);
title.setWidth(width - 1);
if(legend != null) {
if(legend.isVerticalLayout()) {
legend.setX(width - widthMargin);
legend.setY(heightMargin);
legend.setWidth(widthMargin - 1);
legend.setHeight(height - heightMargin - 1);
} else {
legend.setX(0);
legend.setY(height - heightMargin);
legend.setWidth(width - 1);
legend.setHeight(heightMargin - 1);
}
}
}
......@@ -711,11 +596,6 @@ public final class SpiderChartOld {
this.activateSelection = activateSelection;
}
/** Setter for the axis margin */
public void setAxisMargin(final double axisMargin) {
this.axisMargin = axisMargin;
}
/** Setter for the background canvas color */
public void setBackgroundCanvasColor(int swtBackgroundCanvasColor) {
this.swtBackgroundCanvasColor = swtBackgroundCanvasColor;
......@@ -766,23 +646,6 @@ public final class SpiderChartOld {
this.finalImage = finalImage;
}
/** Setter for the height of the chart */
public void setHeight(final int h) {
if(h > this.minimumHeight) {
this.height = h;
}
}
/** Setter for the last height before zoom */
public void setLastHeight(final int lastHeight) {
this.lastHeight = lastHeight;
}
/** Setter for the last width before zoom */
public void setLastWidth(final int lastWidth) {
this.lastWidth = lastWidth;
}
/** Setter for the legend */
public void setLegend(final SpiderChartLegend legend) {
this.legend = legend;
......@@ -819,16 +682,6 @@ public final class SpiderChartOld {
this.offsetY = offsetY;
}
/** Setter for the virtual height */
public void setOriginalVirtualHeight(final int originalVirtualHeight) {
this.originalVirtualHeight = originalVirtualHeight;
}
/** Setter for the virtual width */
public void setOriginalVirtualWidth(final int originalVirtualWidth) {
this.originalVirtualWidth = originalVirtualWidth;
}
/** Setter for the spider chart label */
public void setSelectedLabel(final SpiderChartLabel selectedLabel) {
this.selectedLabel = selectedLabel;
......@@ -849,12 +702,6 @@ public final class SpiderChartOld {
this.showTips = showTips;
}
/** Setter to set the size */
public void setSize(final int w, final int h) {
this.setWidth(w);
this.setHeight(h);
}
/** Setter for the configuration to mark the stop as stopped */
public void setStopped(final boolean stopped) {
this.stopped = stopped;
......@@ -865,27 +712,20 @@ public final class SpiderChartOld {
this.title = title;
}
/** Setter for the virtual height */
public void setVirtualHeight(final int virtualHeight) {
this.virtualHeight = virtualHeight;
}
/** Setter for the virtual width */
public void setVirtualWidth(final int virtualWidth) {
this.virtualWidth = virtualWidth;
}
/** Setter for the width of the chart */
public void setWidth(final int w) {
if(w > this.minimumWidth) {
this.width = w;
}
}
/** Triggers the chart event */
private void triggerChartEvent(final int event) {
for(int i = 0; i < this.chartListeners.size(); i++) {
this.chartListeners.get(i).onChartEvent(this, event);
}
}
/**
* @param bounds
*/
public void setBounds(Rectangle bounds) {
setX(bounds.x);
setY(bounds.y);
setWidth(bounds.width);
setHeight(bounds.height);
}
}
......@@ -24,6 +24,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.fortiss.tooling.spiderchart.SpiderChartOld;
import org.fortiss.tooling.spiderchart.model.SpiderChart;
import org.fortiss.tooling.spiderchart.plotter.SpiderChartLegend;
import org.fortiss.tooling.spiderchart.plotter.SpiderChartPlotter;
import org.fortiss.tooling.spiderchart.plotter.SpiderChartTitle;
......@@ -48,33 +49,37 @@ public final class SpiderChartBuilder {
/** The title */
private SpiderChartTitle title;
private SpiderChart chart;
/** Prepares the legend */
public SpiderChartBuilder(SpiderChartTitle title, SpiderChartLegend legend,
public SpiderChartBuilder(SpiderChart chart, SpiderChartTitle title, SpiderChartLegend legend,
SpiderChartPlotter plotter) {
requireNonNull(title);
this.title = title;
this.chart = requireNonNull(chart);
this.title = requireNonNull(title);
this.legend = legend;
requireNonNull(plotter);
this.plotter = plotter;
this.plotter = requireNonNull(plotter);
}
/** Builds the viewer */
public SpiderChartViewer createViewer(Composite parent) {
requireNonNull(parent);
// Some chart related default configurations
SpiderChartOld chart = new SpiderChartOld(title, plotter);
chart.setBackStyle(new FillStyle(SWT.COLOR_YELLOW));
chart.setBackgroundCanvasColor(SWT.COLOR_WHITE);
chart.getBackStyle().setGradientType(GRADIENT_VERTICAL);
chart.setLegend(legend);
chart.setActivateSelection(true);
SpiderChartOld chartOld = new SpiderChartOld(chart, title, plotter);
chartOld.setBackStyle(new FillStyle(SWT.COLOR_YELLOW));
chartOld.setBackgroundCanvasColor(SWT.COLOR_WHITE);
chartOld.getBackStyle().setGradientType(GRADIENT_VERTICAL);
chartOld.setLegend(legend);
chartOld.setActivateSelection(true);
SpiderChartViewer chartViewer = new SpiderChartViewer(parent, SWT.NONE);
chartViewer.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
chartViewer.setBounds(parent.getShell().getClientArea().x, parent.getShell()
.getClientArea().y, parent.getShell().getClientArea().width, parent.getShell()
.getClientArea().height - 10);
chartViewer.setChart(chart);
chartViewer.setChart(chartOld);
chartOld.setBounds(chartViewer.getBounds());
chartOld.layoutChartComponents();
return chartViewer;
}
}
......@@ -101,7 +101,7 @@ public final class Sample {
plotter.setAxisStyle(brand, AxisStyle.DEFAULT);
plotter.setAxisStyle(screen, AxisStyle.DEFAULT);
SpiderChartBuilder scBuilder = new SpiderChartBuilder(title, legend, plotter);
SpiderChartBuilder scBuilder = new SpiderChartBuilder(spiderChart, title, legend, plotter);
viewer = scBuilder.createViewer(shell);
viewer.getChart().addSeq(iPhoneData);
......
......@@ -48,6 +48,8 @@ public final class SpiderChartLegend extends SpiderChartComponentBase {
/** The size of the color icon of data series. */
private static final int ICON_SIZE = 10;
/** The space between icon and text. */
private static final int ICON_SPACE = 3;
/** Constructor. */
public SpiderChartLegend(SpiderChart chart) {
......@@ -111,77 +113,50 @@ public final class SpiderChartLegend extends SpiderChartComponentBase {
public void drawHorizontal(SpiderChartSwtGraphics g) {
GC gc = g.getGraphics();
int iconWidth = 0;
int totalWidth = 0;
int iconHeight = 0;
int textHeight = getFontData().getHeight();
int textWidth = 0;
for(Pair<DataSeries, LineStyle> pair : items) {
Point extent = null; // FIXME
int xDelta = 0;
if(labelText != null && labelText.trim().length() > 0) {
xDelta = drawHorizontalLabel(gc);
}
int iconSeparator = 3;
int textSeparator = 5;
totalWidth = (textWidth + textSeparator) * items.size();
Color oldColor = gc.getForeground();
int y = getY() + margin;
for(Pair<DataSeries, LineStyle> pair : items) {
if(pair.getSecond() != null) {
iconWidth = Math.max(iconWidth, 10);
iconHeight = Math.max(iconHeight, 10);
}
}
int itemHeight = Math.max(textHeight, iconHeight);
totalWidth += (iconWidth + iconSeparator) * items.size();
String text = pair.getFirst().getName();
Point extent = gc.textExtent(text);
LineStyle l = pair.getSecond();
gc.setForeground(getSystemColor(l.getSwtColor()));
int toCenterX = (width - totalWidth) / 2;
int toCenterY = (height - itemHeight) / 2;
if(toCenterY < 0) {
toCenterY = 0;
}
if(toCenterX < 0) {
toCenterX = 0;
}
final int legendX1 = x + toCenterX;
final int legendY1 = y + toCenterY;
final int legendX2 = x + toCenterX + totalWidth;
final int legendY2 = y + toCenterY + itemHeight;
if(getBackgroundFillStyle() != null) {
getBackgroundFillStyle().draw(g, legendX1 - margin, legendY1 - margin,
legendX2 + margin, legendY2 + margin);
}
if(getLineStyle() != null) {
getLineStyle().drawRect(g, legendX1 - margin, legendY1 - margin, legendX2 + margin,
legendY2 + margin);
}
int offset = 0;
for(int i = 1; i <= items.size(); i++) {
Pair<DataSeries, LineStyle> pair = items.get(i - 1);
gc.drawString(pair.getFirst().getName(), toCenterX + offset + iconWidth +
iconSeparator + x, toCenterY + y + itemHeight, true);
offset = offset + iconWidth + iconSeparator + textWidth + textSeparator;
}
offset = 0;
for(int i = 1; i <= items.size(); i++) {
Pair<DataSeries, LineStyle> pair = items.get(i - 1);
// if(icon instanceof AbstractChartImage) {
// g.drawImage((AbstractChartImage)icon, toCenterX + x + offset, toCenterY +
// y);
// }
if(pair.getSecond() != null) {
LineStyle l = pair.getSecond();
l.draw(g, toCenterX + x + offset, toCenterY + y + iconHeight / 2, toCenterX + x +
iconWidth - 2 + offset, toCenterY + y + iconHeight / 2);
}
// FIXME:
// if(icon instanceof FillStyle) {
// int sidelentgh = iconWidth / 2;
//
// FillStyle f = (FillStyle)icon;
// f.draw(g, toCenterX + x + offset, toCenterY + y, toCenterX + x +
// offset + sidelentgh, toCenterY + y + sidelentgh);
// }
offset = offset + iconWidth + iconSeparator + textWidth + textSeparator;
int xl = getX() + xDelta;
l.setlWidth(ICON_SIZE);
l.draw(g, xl, y + extent.y / 2, xl + ICON_SIZE, y + extent.y / 2);
xDelta = xDelta + ICON_SIZE + ICON_SPACE;
int xs = getX() + xDelta;
gc.drawString(text, xs, y, true);
xDelta = xDelta + extent.x + margin;
}
gc.setForeground(oldColor);
}
/** Draws the horizontal legend label and returns the offset. */
private int drawHorizontalLabel(GC gc) {
Font oldFont = gc.getFont();
Color oldColor = gc.getForeground();
Font font = createFont(labelStyle.getFontData());
gc.setFont(font);
gc.setForeground(getSystemColor(labelStyle.getSwtColor()));
gc.setClipping(getX(), getY(), getWidth(), getHeight());
Point textExtent = gc.textExtent(labelText);
gc.drawString(labelText, getX() + margin, getY() + margin, true);
gc.setClipping((Rectangle)null);
gc.setForeground(oldColor);
gc.setFont(oldFont);
font.dispose();
return textExtent.x + 2 * margin;
}
/** draws the graphics vertically */
......@@ -202,13 +177,6 @@ public final class SpiderChartLegend extends SpiderChartComponentBase {
textHeight = Math.max(textHeight, extent.y);
}
// FIXME: feature disabled
// if(getBackgroundFillStyle() != null) {
// getBackgroundFillStyle().draw(g, x1, y1, x2, y2);
// }
// if(getLineStyle() != null) {
// getLineStyle().drawRect(g, x1, y1, x2, y2);
// }
Color oldColor = gc.getForeground();
int cnt = 0;
for(Pair<DataSeries, LineStyle> pair : items) {
......@@ -226,7 +194,7 @@ public final class SpiderChartLegend extends SpiderChartComponentBase {
gc.setForeground(oldColor);
}
/** Draws the header label for the vertical legend layout. */
/** Draws the header label for the vertical legend layout and returns the offset. */
private int drawVerticalLabel(GC gc) {
Font oldFont = gc.getFont();
Color oldColor = gc.getForeground();
......
......@@ -163,12 +163,6 @@ public final class SpiderChartPlotter extends SpiderChartComponentBase {
// }
}
/** visible height on the canvas */
private int visibleHeight = 0;
/** visible width on the canvas */
private int visibleWidth = 0;
/** x-axis scaling */
private SpiderChartScale xScale;
......@@ -819,6 +813,9 @@ public final class SpiderChartPlotter extends SpiderChartComponentBase {
/** plots the values */
public void plot(SpiderChartSwtGraphics g) {
// FIXME: remove debug rectangle
g.getGraphics().drawRectangle(getX(), getY(), getWidth(), getHeight());
for(int i = 0; i < data.size(); i++) {
plotSequence(g, data.get(i), i);
}
......@@ -853,26 +850,6 @@ public final class SpiderChartPlotter extends SpiderChartComponentBase {
return depth;
}
/** Returns visible width. */
public int getVisibleWidth() {
return visibleWidth;
}
/** Sets visible width. */
public void setVisibleWidth(int visibleWidth) {
this.visibleWidth = visibleWidth;
}
/** Returns visible height. */
public int getVisibleHeight() {
return visibleHeight;
}
/** Sets visible height. */
public void setVisibleHeight(int visibleHeight) {
this.visibleHeight = visibleHeight;
}
/** Plots the axes of the spider chart. */
public void drawAxes(SpiderChartSwtGraphics graphics) {
List<Axis> axes = chart.getAxes();
......
......@@ -51,10 +51,13 @@ public final class SpiderChartTitle extends SpiderChartComponentBase {
/** Used to draw the title */
public void draw(SpiderChartSwtGraphics g) {
GC gc = g.getGraphics();
// FIXME: remove debug rectangle
gc.drawRectangle(getX(), getY(), getWidth(), getHeight());
if(text == null) {
return;
}
GC gc = g.getGraphics();
Font ontheflyFont = createFont();
Font oldFont = gc.getFont();
......@@ -65,6 +68,7 @@ public final class SpiderChartTitle extends SpiderChartComponentBase {
int x = getX() + getWidth() / 2 - extent.x / 2;
int y = getY() + getHeight() / 2 - extent.y / 2;
gc.setForeground(getForegroundColor());
gc.drawString(text, x, y, true);
gc.setForeground(oldColor);
......
......@@ -203,8 +203,8 @@ public final class SpiderChartViewer extends Composite {
}
this.canvas.setChart(c);
this.originalHeight = this.canvas.getChart().getVirtualHeight();
this.originalWidth = this.canvas.getChart().getVirtualWidth();
this.originalHeight = this.canvas.getChart().getHeight();
this.originalWidth = this.canvas.getChart().getWidth();
this.resetChart();
setCanvasSize();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment