work on charts

This commit is contained in:
7u83 2017-09-17 23:55:18 +02:00
parent dc8ca70a62
commit 92930d9417
9 changed files with 137 additions and 110 deletions

View File

@ -1,4 +1,4 @@
#Sat, 16 Sep 2017 18:25:29 +0200
#Sun, 17 Sep 2017 23:52:04 +0200
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=

View File

@ -16,12 +16,12 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
<EmptySpace min="0" pref="498" 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"/>
<EmptySpace min="0" pref="341" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>

View File

@ -32,6 +32,7 @@ public class Chart1 extends javax.swing.JPanel implements QuoteReceiver, Scrolla
return;
}
setSize(new Dimension(9000,500));
Globals.se.addQuoteReceiver(this);
}
@ -42,7 +43,21 @@ public class Chart1 extends javax.swing.JPanel implements QuoteReceiver, Scrolla
if (Globals.se==null)
return;
OHLCData data = Globals.se.getOHLCdata(5000);
g.setColor(Color.red);
g.drawLine(0, 0, 7000, 610);
Dimension d = new Dimension(8000,200);
setPreferredSize(d);
revalidate();
System.out.printf("Setting pref size\n" );
OHLCData data = Globals.se.getOHLCdata(60000);
int first_bar = 0;
int last_bar = data.size();
@ -73,6 +88,8 @@ public class Chart1 extends javax.swing.JPanel implements QuoteReceiver, Scrolla
// Calculate the number of pixels for 1 em
em_width = g.getFontMetrics().stringWidth("M");
drawChart((Graphics2D)g);
}
@ -89,11 +106,11 @@ public class Chart1 extends javax.swing.JPanel implements QuoteReceiver, Scrolla
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
.addGap(0, 498, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
.addGap(0, 341, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents

View File

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[300, 300]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
@ -16,19 +21,25 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="223" max="-2" attributes="0"/>
<EmptySpace pref="71" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="503" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="47" max="32767" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="247" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
@ -37,41 +48,25 @@
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Properties>
<Property name="horizontalScrollBarPolicy" type="int" value="32"/>
<Property name="name" type="java.lang.String" value="" noResource="true"/>
<Property name="verticalScrollBarPolicy" type="int" value="22"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
<Properties>
<Property name="dividerLocation" type="int" value="200"/>
<Property name="dividerSize" type="int" value="5"/>
<Property name="orientation" type="int" value="0"/>
</Properties>
<Container class="chart.Chart1" name="chart11">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="chart.Chart1" name="chart11">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="top"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="862" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="199" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="217" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="241" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Container>

View File

@ -48,46 +48,45 @@ public class ChartPanal extends javax.swing.JPanel {
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jSplitPane1 = new javax.swing.JSplitPane();
chart11 = new chart.Chart1();
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane1.setName(""); // NOI18N
setPreferredSize(new java.awt.Dimension(300, 300));
jSplitPane1.setDividerLocation(200);
jSplitPane1.setDividerSize(5);
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
javax.swing.GroupLayout chart11Layout = new javax.swing.GroupLayout(chart11);
chart11.setLayout(chart11Layout);
chart11Layout.setHorizontalGroup(
chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 862, Short.MAX_VALUE)
.addGap(0, 217, Short.MAX_VALUE)
);
chart11Layout.setVerticalGroup(
chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 199, Short.MAX_VALUE)
.addGap(0, 241, Short.MAX_VALUE)
);
jSplitPane1.setTopComponent(chart11);
jScrollPane1.setViewportView(jSplitPane1);
jScrollPane1.setViewportView(chart11);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1)
.addContainerGap())
.addGap(0, 300, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(71, Short.MAX_VALUE)))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 503, Short.MAX_VALUE)
.addContainerGap())
.addGap(0, 300, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(47, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 247, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap()))
);
}// </editor-fold>//GEN-END:initComponents
@ -95,6 +94,5 @@ public class ChartPanal extends javax.swing.JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private chart.Chart1 chart11;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSplitPane jSplitPane1;
// End of variables declaration//GEN-END:variables
}

View File

@ -24,24 +24,47 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="chartPanal2" pref="504" max="32767" attributes="0"/>
<EmptySpace pref="387" max="32767" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="123" max="-2" 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">
<EmptySpace max="-2" attributes="0"/>
<Component id="chartPanal2" pref="421" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="59" max="32767" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="254" max="-2" attributes="0"/>
<EmptySpace pref="120" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="chart.ChartPanal" name="chartPanal2">
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Properties>
<Property name="horizontalScrollBarPolicy" type="int" value="32"/>
<Property name="verticalScrollBarPolicy" type="int" value="22"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="chart.Chart1" name="chart11">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="102" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="233" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -37,6 +37,7 @@ public class ChartTestDialog extends javax.swing.JDialog {
public ChartTestDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
setLocationRelativeTo(parent);
}
/**
@ -48,25 +49,42 @@ public class ChartTestDialog extends javax.swing.JDialog {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
chartPanal2 = new chart.ChartPanal();
jScrollPane1 = new javax.swing.JScrollPane();
chart11 = new chart.Chart1();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
javax.swing.GroupLayout chart11Layout = new javax.swing.GroupLayout(chart11);
chart11.setLayout(chart11Layout);
chart11Layout.setHorizontalGroup(
chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 102, Short.MAX_VALUE)
);
chart11Layout.setVerticalGroup(
chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 233, Short.MAX_VALUE)
);
jScrollPane1.setViewportView(chart11);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(chartPanal2, javax.swing.GroupLayout.DEFAULT_SIZE, 504, Short.MAX_VALUE)
.addContainerGap(387, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(chartPanal2, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(59, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(120, Short.MAX_VALUE))
);
pack();
@ -115,6 +133,7 @@ public class ChartTestDialog extends javax.swing.JDialog {
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private chart.ChartPanal chartPanal2;
private chart.Chart1 chart11;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}

View File

@ -488,26 +488,13 @@
</Constraint>
</Constraints>
</Component>
<Container class="chart.Chart1" name="chart11">
<Component class="chart.ChartPanal" name="chartPanal1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="104" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="235" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@ -187,7 +187,7 @@ public class SeSimApplication extends javax.swing.JFrame {
quoteVertical1 = new gui.orderbook.QuoteVertical();
jSplitPane5 = new javax.swing.JSplitPane();
statistics1 = new gui.Statistics();
chart11 = new chart.Chart1();
chartPanal1 = new chart.ChartPanal();
menuBar = new javax.swing.JMenuBar();
fileMenu = new javax.swing.JMenu();
openMenuItem = new javax.swing.JMenuItem();
@ -340,19 +340,7 @@ public class SeSimApplication extends javax.swing.JFrame {
jSplitPane5.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
jSplitPane5.setTopComponent(statistics1);
javax.swing.GroupLayout chart11Layout = new javax.swing.GroupLayout(chart11);
chart11.setLayout(chart11Layout);
chart11Layout.setHorizontalGroup(
chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 104, Short.MAX_VALUE)
);
chart11Layout.setVerticalGroup(
chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 235, Short.MAX_VALUE)
);
jSplitPane5.setRightComponent(chart11);
jSplitPane5.setRightComponent(chartPanal1);
jSplitPane3.setLeftComponent(jSplitPane5);
@ -936,7 +924,7 @@ public class SeSimApplication extends javax.swing.JFrame {
private javax.swing.JMenuItem aboutMenuItem;
private javax.swing.JSpinner accelSpinner;
private gui.MainChart chart;
private chart.Chart1 chart11;
private chart.ChartPanal chartPanal1;
private javax.swing.JScrollPane chartSrollPane;
private javax.swing.JMenuItem clearMenuItem;
private gui.Clock clock;