Skip to content

Commit

Permalink
Draw zero lines in volatility / returns diagram
Browse files Browse the repository at this point in the history
Issue: #292
  • Loading branch information
buchen committed May 25, 2015
1 parent 6b7365c commit a3abb19
Showing 1 changed file with 22 additions and 0 deletions.
Expand Up @@ -36,12 +36,15 @@
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.ToolBar;
import org.swtchart.IAxis;
import org.swtchart.ICustomPaintListener;
import org.swtchart.ILineSeries;
import org.swtchart.IPlotArea;
import org.swtchart.ISeries;

public class ReturnsVolatilityChartView extends AbstractHistoricView
Expand Down Expand Up @@ -110,6 +113,25 @@ protected Composite createBody(Composite parent)
yAxis.getTitle().setText(Messages.LabelPeformanceTTWROR);
yAxis.getTick().setFormat(new DecimalFormat("0.##%")); //$NON-NLS-1$

((IPlotArea) chart.getPlotArea()).addCustomPaintListener(new ICustomPaintListener()
{
@Override
public void paintControl(PaintEvent e)
{
int y = xAxis.getPixelCoordinate(0);
e.gc.drawLine(y, 0, y, e.height);

int x = yAxis.getPixelCoordinate(0);
e.gc.drawLine(0, x, e.width, x);
}

@Override
public boolean drawBehindSeries()
{
return true;
}
});

picker = new ChartConfigurator(composite, this, ChartConfigurator.Mode.RETURN_VOLATILITY);
picker.setListener(new ChartConfigurator.Listener()
{
Expand Down

0 comments on commit a3abb19

Please sign in to comment.