Some refactoring
This commit is contained in:
parent
5324d61d4c
commit
844bb6e3b4
@ -1,4 +1,4 @@
|
|||||||
#Tue, 26 Dec 2017 09:36:37 +0100
|
#Tue, 26 Dec 2017 10:12:17 +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=
|
||||||
|
@ -64,7 +64,7 @@ public class MMChart extends javax.swing.JPanel {
|
|||||||
JPanel yLegend;
|
JPanel yLegend;
|
||||||
JPanel mainChart;
|
JPanel mainChart;
|
||||||
|
|
||||||
private final void setupYLegend() {
|
private void setupYLegend() {
|
||||||
yLegend = new ChartPanel();
|
yLegend = new ChartPanel();
|
||||||
Border redborder = javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0));
|
Border redborder = javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0));
|
||||||
yLegend.setBorder(redborder);
|
yLegend.setBorder(redborder);
|
||||||
@ -82,7 +82,7 @@ public class MMChart extends javax.swing.JPanel {
|
|||||||
add(yLegend, gbConstraints);
|
add(yLegend, gbConstraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
final void setupXLegend() {
|
private void setupXLegend() {
|
||||||
xLegend = new ChartPanel();
|
xLegend = new ChartPanel();
|
||||||
// xLegend.setBackground(Color.blue);
|
// xLegend.setBackground(Color.blue);
|
||||||
|
|
||||||
@ -102,7 +102,9 @@ public class MMChart extends javax.swing.JPanel {
|
|||||||
add(xLegend, gbConstraints);
|
add(xLegend, gbConstraints);
|
||||||
|
|
||||||
OHLCChartPainter p;
|
OHLCChartPainter p;
|
||||||
OHLCData mydata = Globals.se.getOHLCdata(Globals.se.getDefaultStock(), 60000 * 20);
|
OHLCData mydata = stock.getOHLCdata(60*20);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// this.xScrollBar.setMaximum(0);
|
// this.xScrollBar.setMaximum(0);
|
||||||
p = new XLegendPainter();
|
p = new XLegendPainter();
|
||||||
@ -111,7 +113,7 @@ public class MMChart extends javax.swing.JPanel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final void setupMainChart() {
|
private void setupMainChart() {
|
||||||
mainChart = new ChartPanel();
|
mainChart = new ChartPanel();
|
||||||
mainChart.setBackground(Color.green);
|
mainChart.setBackground(Color.green);
|
||||||
|
|
||||||
@ -124,11 +126,14 @@ public class MMChart extends javax.swing.JPanel {
|
|||||||
gbConstraints.weighty = 1.0;
|
gbConstraints.weighty = 1.0;
|
||||||
|
|
||||||
add(mainChart, gbConstraints);
|
add(mainChart, gbConstraints);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChartDef chartDef;
|
ChartDef chartDef;
|
||||||
|
|
||||||
final void setupLayout() {
|
private void setupLayout() {
|
||||||
removeAll();
|
removeAll();
|
||||||
|
|
||||||
Border redborder = javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0));
|
Border redborder = javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0));
|
||||||
@ -149,36 +154,6 @@ public class MMChart extends javax.swing.JPanel {
|
|||||||
mainChart = new JPanel();
|
mainChart = new JPanel();
|
||||||
mainChart.setPreferredSize(new Dimension(100, 40));
|
mainChart.setPreferredSize(new Dimension(100, 40));
|
||||||
mainChart.setBackground(Color.blue);
|
mainChart.setBackground(Color.blue);
|
||||||
|
|
||||||
/* p = new JPanel();
|
|
||||||
p.setPreferredSize(new Dimension(100,40));
|
|
||||||
p.setBorder(redborder);
|
|
||||||
p.setBackground(Color.yellow);
|
|
||||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
||||||
gridBagConstraints.gridx = 0;
|
|
||||||
gridBagConstraints.gridy = 1;
|
|
||||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
|
||||||
gridBagConstraints.weightx = 1.0;
|
|
||||||
gridBagConstraints.weighty = 1.0;
|
|
||||||
add(p, gridBagConstraints);
|
|
||||||
|
|
||||||
xLegend = new JPanel();
|
|
||||||
xLegend.setBorder(redborder);
|
|
||||||
xLegend.setBackground(Color.white);
|
|
||||||
xLegend.setPreferredSize(new Dimension(100,0));
|
|
||||||
xLegend.setMinimumSize(new Dimension(100,0));
|
|
||||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
||||||
gridBagConstraints.gridx = 1;
|
|
||||||
gridBagConstraints.gridy = 0;
|
|
||||||
|
|
||||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
|
||||||
gridBagConstraints.weightx = 0.0;
|
|
||||||
gridBagConstraints.weighty = 0.0;
|
|
||||||
add(xLegend, gridBagConstraints);
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
// p.setLayout(layout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int em_width;
|
int em_width;
|
||||||
|
@ -27,16 +27,13 @@ package chart.painter;
|
|||||||
|
|
||||||
import sesim.ChartDef;
|
import sesim.ChartDef;
|
||||||
import sesim.ChartPanel;
|
import sesim.ChartPanel;
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JScrollBar;
|
|
||||||
import sesim.OHLCData;
|
import sesim.OHLCData;
|
||||||
import sesim.OHLCDataItem;
|
import sesim.OHLCDataItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Paints an x-legend for OHLC charts
|
||||||
* @author 7u83 <7u83@mail.ru>
|
* @author 7u83 <7u83@mail.ru>
|
||||||
*/
|
*/
|
||||||
public class XLegendPainter extends OHLCChartPainter {
|
public class XLegendPainter extends OHLCChartPainter {
|
||||||
@ -59,12 +56,7 @@ public class XLegendPainter extends OHLCChartPainter {
|
|||||||
|
|
||||||
init(g);
|
init(g);
|
||||||
|
|
||||||
// g.setColor(Color.black);
|
|
||||||
Dimension size = p.getSize();
|
Dimension size = p.getSize();
|
||||||
|
|
||||||
//int bars = (int) (size.width / (def.x_unit_width * em_size));
|
|
||||||
|
|
||||||
int bars = this.getBars(p, def);
|
|
||||||
|
|
||||||
int first_bar = getFirstBar(p);
|
int first_bar = getFirstBar(p);
|
||||||
|
|
||||||
@ -94,7 +86,6 @@ public class XLegendPainter extends OHLCChartPainter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void drawItem(Graphics2D g, int prevx, int x, OHLCDataItem prev, OHLCDataItem i) {
|
void drawItem(Graphics2D g, int prevx, int x, OHLCDataItem prev, OHLCDataItem i) {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user