Improved chart
This commit is contained in:
parent
888a0f892c
commit
b30efc0b82
@ -13,6 +13,12 @@
|
|||||||
<Property name="text" type="java.lang.String" value="Compression"/>
|
<Property name="text" type="java.lang.String" value="Compression"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
<MenuItem class="javax.swing.JCheckBoxMenuItem" name="jCheckBoxMenuItem1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
|
<Property name="text" type="java.lang.String" value="jCheckBoxMenuItem1"/>
|
||||||
|
</Properties>
|
||||||
|
</MenuItem>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
</NonVisualComponents>
|
</NonVisualComponents>
|
||||||
@ -23,6 +29,7 @@
|
|||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||||
<Border info="null"/>
|
<Border info="null"/>
|
||||||
</Property>
|
</Property>
|
||||||
|
<Property name="doubleBuffered" type="boolean" value="false"/>
|
||||||
<Property name="opaque" type="boolean" value="false"/>
|
<Property name="opaque" type="boolean" value="false"/>
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
<Dimension value="[300, 300]"/>
|
<Dimension value="[300, 300]"/>
|
||||||
@ -47,7 +54,7 @@
|
|||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="589" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
|
@ -18,8 +18,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JViewport;
|
||||||
import javax.swing.Scrollable;
|
import javax.swing.Scrollable;
|
||||||
import sesim.MinMax;
|
import sesim.MinMax;
|
||||||
|
import sesim.Scheduler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -27,11 +30,25 @@ import sesim.MinMax;
|
|||||||
*/
|
*/
|
||||||
public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollable {
|
public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollable {
|
||||||
|
|
||||||
|
class ChartDef {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected int em_size = 1;
|
protected int em_size = 1;
|
||||||
|
|
||||||
protected float bar_width = 0.8f;
|
|
||||||
protected float bar_width_em = 1;
|
protected float bar_width = 2.0f;
|
||||||
protected float y_legend_width = 8;
|
|
||||||
|
|
||||||
|
public void setBarWidth(float bw){
|
||||||
|
bar_width=bw;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//protected float bar_width_em = 1;
|
||||||
|
protected float y_legend_width = 10;
|
||||||
|
|
||||||
protected int num_bars = 4000;
|
protected int num_bars = 4000;
|
||||||
|
|
||||||
@ -44,12 +61,19 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
// data = new OHLCData(60000*30);
|
// data = new OHLCData(60000*30);
|
||||||
//data = new OHLCData(60000*30);
|
//data = new OHLCData(60000*30);
|
||||||
//data = Globals.se.getOHLCdata(60000 * 30);
|
//data = Globals.se.getOHLCdata(60000 * 30);
|
||||||
|
this.setCompression(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form Chart
|
* Creates new form Chart
|
||||||
*/
|
*/
|
||||||
public Chart() {
|
public Chart() {
|
||||||
|
if (Globals.se==null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
initComponents();
|
initComponents();
|
||||||
initChart();
|
initChart();
|
||||||
initCtxMenu();
|
initCtxMenu();
|
||||||
@ -59,6 +83,10 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
}
|
}
|
||||||
|
|
||||||
Globals.se.addQuoteReceiver(this);
|
Globals.se.addQuoteReceiver(this);
|
||||||
|
|
||||||
|
// scrollPane=new JScrollPane();
|
||||||
|
// scrollPane.setViewportView(this);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,12 +129,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
|
|
||||||
OHLCData data;
|
OHLCData data;
|
||||||
|
|
||||||
OHLCDataItem current = null;
|
|
||||||
|
|
||||||
//void drawCandle(Graphics2D g, OHLCData d, int x, int y) {
|
|
||||||
//
|
|
||||||
|
|
||||||
// }
|
|
||||||
@Override
|
@Override
|
||||||
public Dimension getPreferredScrollableViewportSize() {
|
public Dimension getPreferredScrollableViewportSize() {
|
||||||
return this.getPreferredSize();
|
return this.getPreferredSize();
|
||||||
@ -135,7 +158,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
class XLegendDef {
|
class XLegendDef {
|
||||||
|
|
||||||
double unit_width = 1;
|
double unit_width = 1;
|
||||||
int big_tick = 10;
|
int big_tick = 8;
|
||||||
long start;
|
long start;
|
||||||
|
|
||||||
XLegendDef() {
|
XLegendDef() {
|
||||||
@ -143,11 +166,11 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
}
|
}
|
||||||
|
|
||||||
String getAt(int unit) {
|
String getAt(int unit) {
|
||||||
Date date = new Date(/*sesim.Scheduler.timeStart*/0 + unit * 5000);
|
|
||||||
// DateFormat formatter = new SimpleDateFormat("HH:mm:ss:SSS");
|
int fs = data.getFrameSize();
|
||||||
DateFormat formatter = new SimpleDateFormat("HH:mm:ss");
|
return Scheduler.formatTimeMillis(0+unit*fs);
|
||||||
String dateFormatted = formatter.format(date);
|
|
||||||
return dateFormatted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -158,15 +181,10 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
|
|
||||||
void drawXLegend(Graphics2D g, XLegendDef xld) {
|
void drawXLegend(Graphics2D g, XLegendDef xld) {
|
||||||
|
|
||||||
//XLegendDef xld = new XLegendDef();
|
|
||||||
g = (Graphics2D) g.create();
|
g = (Graphics2D) g.create();
|
||||||
|
|
||||||
int xl_height = 30;
|
|
||||||
Dimension dim = this.getSize();
|
Dimension dim = getSize();
|
||||||
|
|
||||||
int em_height = g.getFontMetrics().getHeight();
|
|
||||||
int em_width = g.getFontMetrics().stringWidth("M");
|
|
||||||
|
|
||||||
int y = dim.height - em_height * 3;
|
int y = dim.height - em_height * 3;
|
||||||
|
|
||||||
g.drawLine(0, y, dim.width, y);
|
g.drawLine(0, y, dim.width, y);
|
||||||
@ -174,18 +192,18 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
int n;
|
int n;
|
||||||
double x;
|
double x;
|
||||||
|
|
||||||
for (n = 0, x = 0; x < dim.width; x += em_width * xld.unit_width) {
|
for (n = 0, x = 0; x < dim.width; x += em_size * xld.unit_width) {
|
||||||
|
|
||||||
if (n % xld.big_tick == 0) {
|
if (n % xld.big_tick == 0) {
|
||||||
g.drawLine((int) x, y, (int) x, y + em_height);
|
g.drawLine((int) x, y, (int) x, y + em_size);
|
||||||
} else {
|
} else {
|
||||||
g.drawLine((int) x, y, (int) x, y + em_height / 2);
|
g.drawLine((int) x, y, (int) x, y + em_size / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n % xld.big_tick == 0) {
|
if (n % xld.big_tick == 0) {
|
||||||
String text = "Hello";
|
String text;
|
||||||
|
|
||||||
text = xld.getAt(n);
|
text = xld.getAt(n);
|
||||||
|
|
||||||
int swidth = g.getFontMetrics().stringWidth(text);
|
int swidth = g.getFontMetrics().stringWidth(text);
|
||||||
|
|
||||||
g.drawString(text, (int) x - swidth / 2, y + em_height * 2);
|
g.drawString(text, (int) x - swidth / 2, y + em_height * 2);
|
||||||
@ -320,13 +338,26 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
|
|
||||||
private void drawYLegend(Graphics2D g) {
|
private void drawYLegend(Graphics2D g) {
|
||||||
|
|
||||||
|
// g.setClip(null);
|
||||||
|
System.out.printf("Drawing legend\n");
|
||||||
Dimension dim0 = this.getSize();
|
Dimension dim0 = this.getSize();
|
||||||
Rectangle dim = g.getClipBounds();
|
Rectangle dim = g.getClipBounds();
|
||||||
|
dim = this.clip_bounds;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Dimension rv = this.getSize();
|
||||||
|
System.out.printf("W: %d,%d\n",rv.width,rv.height );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int yw = (int) (this.y_legend_width * this.em_size);
|
int yw = (int) (this.y_legend_width * this.em_size);
|
||||||
|
|
||||||
// System.out.printf("MinMax: %f %f\n", c_mm.min, c_mm.max);
|
|
||||||
|
g.setColor(Color.BLUE);
|
||||||
g.drawLine(dim.width + dim.x - yw, 0, dim.width + dim.x - yw, dim.height);
|
g.drawLine(dim.width + dim.x - yw, 0, dim.width + dim.x - yw, dim.height);
|
||||||
|
g.setColor(Color.YELLOW);
|
||||||
|
System.out.printf("Dim: %d %d %d %d\n", dim.x,dim.y,dim.width,dim.height);
|
||||||
|
|
||||||
// float yscale = gdim.height / c_mm.getDiff();
|
// float yscale = gdim.height / c_mm.getDiff();
|
||||||
c_yscaling = c_rect.height / c_mm.getDiff();
|
c_yscaling = c_rect.height / c_mm.getDiff();
|
||||||
@ -352,6 +383,10 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
private MinMax c_mm = null;
|
private MinMax c_mm = null;
|
||||||
private Rectangle c_rect;
|
private Rectangle c_rect;
|
||||||
|
|
||||||
|
|
||||||
|
private int em_height;
|
||||||
|
private int em_width;
|
||||||
|
|
||||||
private void draw(Graphics2D g) {
|
private void draw(Graphics2D g) {
|
||||||
|
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
@ -369,12 +404,15 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
c_mm.min /= 1.5; //-= c_mm.min/ 2.0f;
|
c_mm.min /= 1.5; //-= c_mm.min/ 2.0f;
|
||||||
c_mm.max *= 1.2; //+= c_mm.max / 10.0f;
|
c_mm.max *= 1.2; //+= c_mm.max / 10.0f;
|
||||||
|
|
||||||
|
em_height = g.getFontMetrics().getHeight();
|
||||||
|
em_width = g.getFontMetrics().stringWidth("M");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OHLCDataItem di0 = data.get(0);
|
OHLCDataItem di0 = data.get(0);
|
||||||
XLegendDef xld = new XLegendDef();
|
XLegendDef xld = new XLegendDef();
|
||||||
this.drawXLegend(g, xld);
|
this.drawXLegend(g, xld);
|
||||||
|
|
||||||
int em_height = g.getFontMetrics().getHeight();
|
|
||||||
int em_width = g.getFontMetrics().stringWidth("M");
|
|
||||||
|
|
||||||
//this.getSize();
|
//this.getSize();
|
||||||
int pwidth = em_width * num_bars;
|
int pwidth = em_width * num_bars;
|
||||||
@ -429,30 +467,54 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initEmSize(Graphics g) {
|
|
||||||
|
|
||||||
em_size = g.getFontMetrics().stringWidth("M");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private float c_font_height;
|
private float c_font_height;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void paintComponent(Graphics g) {
|
public final void paintComponent(Graphics g) {
|
||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
|
|
||||||
this.initEmSize(g);
|
// Calculate the number of pixels for 1 em
|
||||||
|
em_size = g.getFontMetrics().stringWidth("M");
|
||||||
|
|
||||||
|
|
||||||
this.gdim = this.getParent().getSize(gdim);
|
this.gdim = this.getParent().getSize(gdim);
|
||||||
this.getParent().setPreferredSize(gdim);
|
this.getParent().setPreferredSize(gdim);
|
||||||
|
|
||||||
this.clip_bounds = g.getClipBounds(this.clip_bounds);
|
Object o = this.getParent();
|
||||||
|
|
||||||
|
JViewport vp = (JViewport) this.getParent();
|
||||||
|
vp.getExtentSize();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this.clip_bounds=g.getClipBounds();
|
||||||
|
|
||||||
|
Dimension r = vp.getExtentSize();
|
||||||
|
|
||||||
|
System.out.printf("Repainting called %d %d %d %d\n", r.width,r.height,clip_bounds.width,clip_bounds.height);
|
||||||
|
|
||||||
|
clip_bounds.width=r.width;
|
||||||
|
clip_bounds.height=r.height;
|
||||||
|
clip_bounds.x=0;
|
||||||
|
clip_bounds.y=0;
|
||||||
|
Point vvp = vp.getViewPosition();
|
||||||
|
clip_bounds.x=vvp.x;
|
||||||
|
clip_bounds.y=vvp.y;
|
||||||
|
|
||||||
|
this.clip_bounds=vp.getViewRect();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// System.out.printf("X:%d %d\n",gdim.width,gdim.height);
|
// System.out.printf("X:%d %d\n",gdim.width,gdim.height);
|
||||||
first_bar = (int) (clip_bounds.x / (this.bar_width * this.em_size));
|
first_bar = (int) (clip_bounds.x / (this.bar_width * this.em_size));
|
||||||
last_bar = 1 + (int) ((clip_bounds.x + clip_bounds.width - (this.y_legend_width * em_size)) / (this.bar_width * this.em_size));
|
last_bar = 1 + (int) ((clip_bounds.x + clip_bounds.width - (this.y_legend_width * em_size)) / (this.bar_width * this.em_size));
|
||||||
|
|
||||||
|
|
||||||
c_font_height = g.getFontMetrics().getHeight();
|
c_font_height = g.getFontMetrics().getHeight();
|
||||||
|
|
||||||
|
System.out.printf("First %d, last %d\n", first_bar,last_bar);
|
||||||
|
|
||||||
draw((Graphics2D) g);
|
draw((Graphics2D) g);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,12 +529,18 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
|
|
||||||
ctxMenu = new javax.swing.JPopupMenu();
|
ctxMenu = new javax.swing.JPopupMenu();
|
||||||
compMenu = new javax.swing.JMenu();
|
compMenu = new javax.swing.JMenu();
|
||||||
|
jCheckBoxMenuItem1 = new javax.swing.JCheckBoxMenuItem();
|
||||||
|
|
||||||
compMenu.setText("Compression");
|
compMenu.setText("Compression");
|
||||||
ctxMenu.add(compMenu);
|
ctxMenu.add(compMenu);
|
||||||
|
|
||||||
|
jCheckBoxMenuItem1.setSelected(true);
|
||||||
|
jCheckBoxMenuItem1.setText("jCheckBoxMenuItem1");
|
||||||
|
ctxMenu.add(jCheckBoxMenuItem1);
|
||||||
|
|
||||||
setBackground(java.awt.Color.white);
|
setBackground(java.awt.Color.white);
|
||||||
setBorder(null);
|
setBorder(null);
|
||||||
|
setDoubleBuffered(false);
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
setPreferredSize(new java.awt.Dimension(300, 300));
|
setPreferredSize(new java.awt.Dimension(300, 300));
|
||||||
setRequestFocusEnabled(false);
|
setRequestFocusEnabled(false);
|
||||||
@ -486,7 +554,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 300, Short.MAX_VALUE)
|
.addGap(0, 589, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
@ -500,16 +568,24 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.invalidate();
|
||||||
|
|
||||||
|
this.ctxMenu.setVisible(true);
|
||||||
this.ctxMenu.show(this, evt.getX(), evt.getY());
|
this.ctxMenu.show(this, evt.getX(), evt.getY());
|
||||||
|
|
||||||
|
this.invalidate();
|
||||||
|
this.repaint();
|
||||||
|
|
||||||
|
|
||||||
}//GEN-LAST:event_formMousePressed
|
}//GEN-LAST:event_formMousePressed
|
||||||
|
|
||||||
void setCompression(int timeFrame) {
|
void setCompression(int timeFrame) {
|
||||||
data = Globals.se.getOHLCdata(timeFrame);
|
data = Globals.se.getOHLCdata(timeFrame);
|
||||||
|
invalidate();
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void UpdateQuote(Quote q) {
|
public void UpdateQuote(Quote q) {
|
||||||
// System.out.print("Quote Received\n");
|
// System.out.print("Quote Received\n");
|
||||||
@ -524,5 +600,6 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JMenu compMenu;
|
private javax.swing.JMenu compMenu;
|
||||||
private javax.swing.JPopupMenu ctxMenu;
|
private javax.swing.JPopupMenu ctxMenu;
|
||||||
|
private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem1;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
}
|
}
|
||||||
|
@ -16,38 +16,13 @@
|
|||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<EmptySpace min="0" pref="629" max="32767" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="chart2" pref="617" max="32767" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<EmptySpace min="0" pref="333" max="32767" attributes="0"/>
|
||||||
<EmptySpace pref="27" max="32767" attributes="0"/>
|
|
||||||
<Component id="chart2" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<SubComponents>
|
|
||||||
<Container class="chart.Chart" name="chart2">
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="617" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -427,39 +427,19 @@ public class FullChart extends javax.swing.JPanel {
|
|||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
chart2 = new chart.Chart();
|
|
||||||
|
|
||||||
javax.swing.GroupLayout chart2Layout = new javax.swing.GroupLayout(chart2);
|
|
||||||
chart2.setLayout(chart2Layout);
|
|
||||||
chart2Layout.setHorizontalGroup(
|
|
||||||
chart2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 617, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
chart2Layout.setVerticalGroup(
|
|
||||||
chart2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 300, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGap(0, 629, Short.MAX_VALUE)
|
||||||
.addContainerGap()
|
|
||||||
.addComponent(chart2, javax.swing.GroupLayout.DEFAULT_SIZE, 617, Short.MAX_VALUE)
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGap(0, 333, Short.MAX_VALUE)
|
||||||
.addContainerGap(27, Short.MAX_VALUE)
|
|
||||||
.addComponent(chart2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private chart.Chart chart2;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
}
|
}
|
||||||
|
41
src/main/java/chart/NewJPanel1.form
Normal file
41
src/main/java/chart/NewJPanel1.form
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||||
|
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||||
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
|
</AuxValues>
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="jScrollPane1" pref="388" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Component id="jScrollPane1" pref="294" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
<SubComponents>
|
||||||
|
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||||
|
</Container>
|
||||||
|
</SubComponents>
|
||||||
|
</Form>
|
73
src/main/java/chart/NewJPanel1.java
Normal file
73
src/main/java/chart/NewJPanel1.java
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 7u83 <7u83@mail.ru>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package chart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 7u83 <7u83@mail.ru>
|
||||||
|
*/
|
||||||
|
public class NewJPanel1 extends javax.swing.JPanel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates new form NewJPanel1
|
||||||
|
*/
|
||||||
|
public NewJPanel1() {
|
||||||
|
initComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called from within the constructor to initialize the form.
|
||||||
|
* WARNING: Do NOT modify this code. The content of this method is always
|
||||||
|
* regenerated by the Form Editor.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
|
private void initComponents() {
|
||||||
|
|
||||||
|
jScrollPane1 = new javax.swing.JScrollPane();
|
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
|
this.setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE)
|
||||||
|
.addContainerGap())
|
||||||
|
);
|
||||||
|
layout.setVerticalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
|
||||||
|
.addContainerGap())
|
||||||
|
);
|
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JScrollPane jScrollPane1;
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
}
|
@ -276,7 +276,7 @@
|
|||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,65,0,0,3,124"/>
|
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,-122,0,0,3,-71"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||||
@ -297,7 +297,7 @@
|
|||||||
<Component id="jButton2" min="-2" pref="67" max="-2" attributes="0"/>
|
<Component id="jButton2" min="-2" pref="67" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="stopButton" min="-2" pref="63" max="-2" attributes="0"/>
|
<Component id="stopButton" min="-2" pref="63" max="-2" attributes="0"/>
|
||||||
<EmptySpace pref="484" max="32767" attributes="0"/>
|
<EmptySpace pref="545" max="32767" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="clock" alignment="1" min="-2" max="-2" attributes="0"/>
|
<Component id="clock" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
@ -453,16 +453,21 @@
|
|||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Container class="chart.Chart" name="chart">
|
<Container class="chart.Chart" name="chart">
|
||||||
|
<Properties>
|
||||||
|
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
|
<Dimension value="[892, 410]"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
|
||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="892" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="410" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -258,7 +258,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
|
|||||||
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(stopButton, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(stopButton, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 484, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 545, Short.MAX_VALUE)
|
||||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(clock, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(clock, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||||
@ -291,15 +291,17 @@ public class NewMDIApplication extends javax.swing.JFrame {
|
|||||||
jSplitPane4.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
jSplitPane4.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||||
jSplitPane4.setBottomComponent(orderBooksHorizontal1);
|
jSplitPane4.setBottomComponent(orderBooksHorizontal1);
|
||||||
|
|
||||||
|
chart.setPreferredSize(new java.awt.Dimension(892, 410));
|
||||||
|
|
||||||
javax.swing.GroupLayout chartLayout = new javax.swing.GroupLayout(chart);
|
javax.swing.GroupLayout chartLayout = new javax.swing.GroupLayout(chart);
|
||||||
chart.setLayout(chartLayout);
|
chart.setLayout(chartLayout);
|
||||||
chartLayout.setHorizontalGroup(
|
chartLayout.setHorizontalGroup(
|
||||||
chartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
chartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 300, Short.MAX_VALUE)
|
.addGap(0, 892, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
chartLayout.setVerticalGroup(
|
chartLayout.setVerticalGroup(
|
||||||
chartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
chartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 300, Short.MAX_VALUE)
|
.addGap(0, 410, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
jChartScrollPane.setViewportView(chart);
|
jChartScrollPane.setViewportView(chart);
|
||||||
|
@ -31,7 +31,7 @@ import java.util.*;
|
|||||||
*
|
*
|
||||||
* @author 7u83 <7u83@mail.ru>
|
* @author 7u83 <7u83@mail.ru>
|
||||||
*/
|
*/
|
||||||
public class OHLCData { //extends ArrayList <OHLCDataItem> {
|
public class OHLCData {
|
||||||
|
|
||||||
private float max=0;
|
private float max=0;
|
||||||
private float min=0;
|
private float min=0;
|
||||||
@ -39,6 +39,7 @@ public class OHLCData { //extends ArrayList <OHLCDataItem> {
|
|||||||
private int frame_size=60000;
|
private int frame_size=60000;
|
||||||
int max_size=100;
|
int max_size=100;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public OHLCData(){
|
public OHLCData(){
|
||||||
|
|
||||||
@ -49,9 +50,6 @@ public class OHLCData { //extends ArrayList <OHLCDataItem> {
|
|||||||
this.frame_size=frame_size;
|
this.frame_size=frame_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// long time_start;
|
|
||||||
// long time_step;
|
|
||||||
|
|
||||||
public float getMax() {
|
public float getMax() {
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user