work on improved ylegend painter

This commit is contained in:
7u83 2018-01-07 23:35:19 +01:00
parent f74c620464
commit f957dde5d4
5 changed files with 23 additions and 6 deletions

View File

@ -1,4 +1,4 @@
#Sat, 06 Jan 2018 13:11:03 +0100
#Sun, 07 Jan 2018 23:34:07 +0100
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=

View File

@ -30,6 +30,7 @@ import chart.painter.ChartPainter;
import chart.painter.OHLCChartPainter;
import chart.painter.XLegendDetail;
import chart.painter.XLegendPainter;
import chart.painter.YLegendPainter;
import gui.Globals;
import java.awt.Color;
import java.awt.Dimension;
@ -65,7 +66,7 @@ public class MMChart extends javax.swing.JPanel {
}
ChartPanel xLegend;
JPanel yLegend;
ChartPanel yLegend;
ChartPanel mainChart;
private void setupYLegend() {
@ -85,6 +86,14 @@ public class MMChart extends javax.swing.JPanel {
add(yLegend, gbConstraints);
this.addMouseMotionListener(yLegend);
OHLCChartPainter ylp = new YLegendPainter(/*null*/);
OHLCData mydata = stock.getOHLCdata(60000);
ylp.setOHLCData(mydata);
yLegend.setChartDef(chartDef);
yLegend.addChartPainter(ylp);
}
private void setupXLegend() {

View File

@ -193,7 +193,7 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
p.setOHLCData(mysma2);
chart.addChartPainter(p);
OHLCChartPainter yp = new YLegendPainter(chart);
OHLCChartPainter yp = new YLegendPainter(/*chart*/);
// yp.setDataProvider(this);
yp.setOHLCData(mydata);

View File

@ -97,7 +97,9 @@ abstract public class ChartPainter implements ChartPainterInterface{
}
float getRoundNumber(float n){
protected float getRoundNumber(float n){
System.out.printf("Rounded number", 0);
return (float)0.0;
}

View File

@ -32,6 +32,7 @@ import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import sesim.MinMax;
import sesim.OHLCData;
import sesim.OHLCDataItem;
/**
@ -42,14 +43,16 @@ public class YLegendPainter extends OHLCChartPainter {
ChartPanel master;
public YLegendPainter (ChartPanel master){
this.master=master;
public YLegendPainter (/*ChartPanel master*/){
// this.master=master;
}
@Override
public void drawChart(Graphics2D g, ChartPanel p, ChartDef def) {
init(g);
this.master = def.mainChart;
OHLCData da = getData();
Dimension dim = def.mainChart.getSize();
int first_bar = getFirstBar(master);
@ -58,6 +61,9 @@ public class YLegendPainter extends OHLCChartPainter {
this.initGetY(minmax, dim);
this.getRoundNumber(90);
//Rectangle dim;
// dim = p.getSize();