some code cleaning
This commit is contained in:
parent
ccf1b61796
commit
dd1fbd6199
@ -5,5 +5,5 @@ javac.debug=true
|
|||||||
javadoc.preview=true
|
javadoc.preview=true
|
||||||
jnlp.signing.keypass=123456
|
jnlp.signing.keypass=123456
|
||||||
jnlp.signing.storepass=123456
|
jnlp.signing.storepass=123456
|
||||||
user.properties.file=/home/tobias/.netbeans/8.1/build.properties
|
user.properties.file=/home/tube/.netbeans/8.1/build.properties
|
||||||
ivy.home=/usr/share/java/
|
ivy.home=/usr/share/java/
|
||||||
|
@ -3,11 +3,23 @@
|
|||||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||||
<group>
|
<group>
|
||||||
<file>file:/home/tobias/NetBeansProjects/SeSim/src/sesim/AutoTraderGui.java</file>
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/traders/RandomTraderA.java</file>
|
||||||
<file>file:/home/tobias/NetBeansProjects/SeSim/src/sesim/AutoTraderLoader.java</file>
|
<file>file:/home/tube/NetBeansProjects/SeSim/test/sesim/Test.java</file>
|
||||||
<file>file:/home/tobias/NetBeansProjects/SeSim/src/gui/Globals.java</file>
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/StatisticsPanel.java</file>
|
||||||
<file>file:/home/tobias/NetBeansProjects/SeSim/src/chart/Chart.java</file>
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/OHLCData.java</file>
|
||||||
<file>file:/home/tobias/NetBeansProjects/SeSim/src/gui/NewMDIApplication.java</file>
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/MinMax.java</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/build.xml</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/AutoTraderLoader.java</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/traders/ManTrader/ManTrader.java</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/NewMDIApplication.java</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/AboutDialog.java</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/FullChart.java</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/EditAutoTraderList.java</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/nbproject/jnlp-impl.xml</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/README.md</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/EditStrategies.java</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/Chart.java</file>
|
||||||
|
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/MainChart.java</file>
|
||||||
</group>
|
</group>
|
||||||
</open-files>
|
</open-files>
|
||||||
</project-private>
|
</project-private>
|
||||||
|
@ -41,7 +41,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
/**
|
/**
|
||||||
* width of y legend in em
|
* width of y legend in em
|
||||||
*/
|
*/
|
||||||
protected float y_legend_width = 10;
|
protected float yl_width = 10;
|
||||||
|
|
||||||
protected int num_bars = 4000;
|
protected int num_bars = 4000;
|
||||||
|
|
||||||
@ -78,7 +78,6 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
// scrollPane.setViewportView(this);
|
// scrollPane.setViewportView(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OHLCData data;
|
OHLCData data;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -149,40 +148,24 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
*/
|
*/
|
||||||
void drawXLegend(Graphics2D g, XLegendDef xld) {
|
void drawXLegend(Graphics2D g, XLegendDef xld) {
|
||||||
|
|
||||||
|
// Caluclate with of y legend in pixels
|
||||||
|
int yl_width_p = (int) (yl_width * em_width);
|
||||||
|
|
||||||
int yw = (int) (this.y_legend_width * this.em_width);
|
g.setClip(clip_bounds.x, clip_bounds.y, clip_bounds.width - yl_width_p, clip_bounds.height);
|
||||||
|
|
||||||
//g.setColor(Color.BLUE);
|
|
||||||
|
|
||||||
|
|
||||||
// g.drawRect(clip_bounds.x, clip_bounds.y, clip_bounds.width - yw-1, clip_bounds.height-1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
g.setClip(clip_bounds.x, clip_bounds.y, clip_bounds.width - yw, clip_bounds.height);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dimension dim = getSize();
|
|
||||||
|
|
||||||
|
|
||||||
System.out.printf("%d %d vs %d %d\n", dim.width,dim.height,clip_bounds.width,clip_bounds.height);
|
|
||||||
//System.exit(0);
|
|
||||||
|
|
||||||
|
|
||||||
int y = clip_bounds.height - em_height * xl_height;
|
int y = clip_bounds.height - em_height * xl_height;
|
||||||
|
|
||||||
// g.drawLine(0, y, dim.width, y);
|
|
||||||
|
|
||||||
// Set background color
|
// Set background color
|
||||||
if (this.xl_bgcolor != null) {
|
if (this.xl_bgcolor != null) {
|
||||||
Color cur = g.getColor();
|
Color cur = g.getColor();
|
||||||
g.setColor(xl_bgcolor);
|
g.setColor(xl_bgcolor);
|
||||||
g.fillRect(0, y, dim.width, em_height * xl_height);
|
g.fillRect(clip_bounds.x, y, clip_bounds.width, em_height * xl_height);
|
||||||
g.drawRect(0, y, dim.width, em_height * xl_height);
|
g.drawRect(clip_bounds.y, y, clip_bounds.width, em_height * xl_height);
|
||||||
g.setColor(cur);
|
g.setColor(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dimension dim = getSize();
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
double x;
|
double x;
|
||||||
|
|
||||||
@ -372,7 +355,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
dim = this.clip_bounds;
|
dim = this.clip_bounds;
|
||||||
|
|
||||||
// Dimension rv = this.getSize();
|
// Dimension rv = this.getSize();
|
||||||
int yw = (int) (this.y_legend_width * this.em_width);
|
int yw = (int) (this.yl_width * this.em_width);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@ -420,7 +403,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
this.drawYLegend(ctx);
|
this.drawYLegend(ctx);
|
||||||
|
|
||||||
/// ctx.g.setColor(Color.ORANGE);
|
/// ctx.g.setColor(Color.ORANGE);
|
||||||
int yw = (int) (this.y_legend_width * this.em_width);
|
int yw = (int) (this.yl_width * this.em_width);
|
||||||
|
|
||||||
ctx.g.setClip(clip_bounds.x, clip_bounds.y, clip_bounds.width - yw, clip_bounds.height);
|
ctx.g.setClip(clip_bounds.x, clip_bounds.y, clip_bounds.width - yw, clip_bounds.height);
|
||||||
// ctx.g.setClip(ctx.rect.x, ctx.rect.y, ctx.rect.width-yw, ctx.rect.height);
|
// ctx.g.setClip(ctx.rect.x, ctx.rect.y, ctx.rect.width-yw, ctx.rect.height);
|
||||||
@ -472,7 +455,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
vol.height = 0.2f;
|
vol.height = 0.2f;
|
||||||
vol.type = ChartType.VOL;
|
vol.type = ChartType.VOL;
|
||||||
vol.data = this.data;
|
vol.data = this.data;
|
||||||
// vol.bgcolor = Color.GRAY;
|
// vol.bgcolor = Color.GRAY;
|
||||||
addChart(vol);
|
addChart(vol);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,12 +482,12 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
|
|
||||||
int cheight = gdim.height - (xl_height * 2) * em_width;
|
int cheight = gdim.height - (xl_height * 2) * em_width;
|
||||||
|
|
||||||
cheight = clip_bounds.height - xl_height * em_width;
|
cheight = clip_bounds.height - xl_height * em_width;
|
||||||
|
|
||||||
int my = clip_bounds.height - em_height * xl_height;
|
int my = clip_bounds.height - em_height * xl_height;
|
||||||
|
|
||||||
g.setColor(Color.RED);
|
g.setColor(Color.GREEN);
|
||||||
g.drawRect(clip_bounds.x,clip_bounds.y,clip_bounds.width,my);
|
g.drawRect(clip_bounds.x, clip_bounds.y, clip_bounds.width, my);
|
||||||
|
|
||||||
int h = (int) (my * d.height);
|
int h = (int) (my * d.height);
|
||||||
|
|
||||||
@ -512,8 +495,6 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
|
|
||||||
g.draw(c_rect);
|
g.draw(c_rect);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RenderCtx ctx = new RenderCtx();
|
RenderCtx ctx = new RenderCtx();
|
||||||
|
|
||||||
ctx.rect = c_rect;
|
ctx.rect = c_rect;
|
||||||
@ -536,7 +517,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
|
|
||||||
drawChart(ctx);
|
drawChart(ctx);
|
||||||
|
|
||||||
h1 = h1+h;
|
h1 = h1 + h;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,8 +531,8 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
if (data.size() == 0) {
|
if (data.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// g.setColor(Color.RED);
|
// g.setColor(Color.RED);
|
||||||
// g.drawRect(0,0,gdim.width,gdim.height);
|
// g.drawRect(0,0,gdim.width,gdim.height);
|
||||||
|
|
||||||
this.setupCharts();
|
this.setupCharts();
|
||||||
|
|
||||||
@ -696,7 +677,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
|||||||
this.clip_bounds = vp.getViewRect();
|
this.clip_bounds = vp.getViewRect();
|
||||||
|
|
||||||
first_bar = (int) (clip_bounds.x / (this.x_unit_width * this.em_width));
|
first_bar = (int) (clip_bounds.x / (this.x_unit_width * this.em_width));
|
||||||
last_bar = 1 + (int) ((clip_bounds.x + clip_bounds.width - (this.y_legend_width * em_width)) / (this.x_unit_width * this.em_width));
|
last_bar = 1 + (int) ((clip_bounds.x + clip_bounds.width - (this.yl_width * em_width)) / (this.x_unit_width * this.em_width));
|
||||||
|
|
||||||
// num_bars = data.size(); // + (int) (clip_bounds.width / (this.x_unit_width * this.em_width))+5;
|
// num_bars = data.size(); // + (int) (clip_bounds.width / (this.x_unit_width * this.em_width))+5;
|
||||||
// num_bars=1;
|
// num_bars=1;
|
||||||
|
Loading…
Reference in New Issue
Block a user