work on improved ylegend painter
This commit is contained in:
parent
f74c620464
commit
f957dde5d4
@ -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=true
|
||||||
annotation.processing.enabled.in.editor=false
|
annotation.processing.enabled.in.editor=false
|
||||||
annotation.processing.processors.list=
|
annotation.processing.processors.list=
|
||||||
|
@ -30,6 +30,7 @@ import chart.painter.ChartPainter;
|
|||||||
import chart.painter.OHLCChartPainter;
|
import chart.painter.OHLCChartPainter;
|
||||||
import chart.painter.XLegendDetail;
|
import chart.painter.XLegendDetail;
|
||||||
import chart.painter.XLegendPainter;
|
import chart.painter.XLegendPainter;
|
||||||
|
import chart.painter.YLegendPainter;
|
||||||
import gui.Globals;
|
import gui.Globals;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
@ -65,7 +66,7 @@ public class MMChart extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ChartPanel xLegend;
|
ChartPanel xLegend;
|
||||||
JPanel yLegend;
|
ChartPanel yLegend;
|
||||||
ChartPanel mainChart;
|
ChartPanel mainChart;
|
||||||
|
|
||||||
private void setupYLegend() {
|
private void setupYLegend() {
|
||||||
@ -85,6 +86,14 @@ public class MMChart extends javax.swing.JPanel {
|
|||||||
|
|
||||||
add(yLegend, gbConstraints);
|
add(yLegend, gbConstraints);
|
||||||
this.addMouseMotionListener(yLegend);
|
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() {
|
private void setupXLegend() {
|
||||||
|
@ -193,7 +193,7 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
|
|||||||
p.setOHLCData(mysma2);
|
p.setOHLCData(mysma2);
|
||||||
chart.addChartPainter(p);
|
chart.addChartPainter(p);
|
||||||
|
|
||||||
OHLCChartPainter yp = new YLegendPainter(chart);
|
OHLCChartPainter yp = new YLegendPainter(/*chart*/);
|
||||||
// yp.setDataProvider(this);
|
// yp.setDataProvider(this);
|
||||||
yp.setOHLCData(mydata);
|
yp.setOHLCData(mydata);
|
||||||
|
|
||||||
|
@ -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;
|
return (float)0.0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import java.awt.Dimension;
|
|||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import sesim.MinMax;
|
import sesim.MinMax;
|
||||||
|
import sesim.OHLCData;
|
||||||
import sesim.OHLCDataItem;
|
import sesim.OHLCDataItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,14 +43,16 @@ public class YLegendPainter extends OHLCChartPainter {
|
|||||||
|
|
||||||
ChartPanel master;
|
ChartPanel master;
|
||||||
|
|
||||||
public YLegendPainter (ChartPanel master){
|
public YLegendPainter (/*ChartPanel master*/){
|
||||||
this.master=master;
|
// this.master=master;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawChart(Graphics2D g, ChartPanel p, ChartDef def) {
|
public void drawChart(Graphics2D g, ChartPanel p, ChartDef def) {
|
||||||
init(g);
|
init(g);
|
||||||
|
this.master = def.mainChart;
|
||||||
|
|
||||||
|
OHLCData da = getData();
|
||||||
|
|
||||||
Dimension dim = def.mainChart.getSize();
|
Dimension dim = def.mainChart.getSize();
|
||||||
int first_bar = getFirstBar(master);
|
int first_bar = getFirstBar(master);
|
||||||
@ -59,6 +62,9 @@ public class YLegendPainter extends OHLCChartPainter {
|
|||||||
this.initGetY(minmax, dim);
|
this.initGetY(minmax, dim);
|
||||||
|
|
||||||
|
|
||||||
|
this.getRoundNumber(90);
|
||||||
|
|
||||||
|
|
||||||
//Rectangle dim;
|
//Rectangle dim;
|
||||||
// dim = p.getSize();
|
// dim = p.getSize();
|
||||||
// dim = this.clip_bounds;
|
// dim = this.clip_bounds;
|
||||||
|
Loading…
Reference in New Issue
Block a user