charting x legend
This commit is contained in:
parent
6f1ef38ad5
commit
74ab5ec81d
@ -1,4 +1,4 @@
|
||||
#Tue, 26 Dec 2017 10:12:17 +0100
|
||||
#Wed, 27 Dec 2017 08:42:22 +0100
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processors.list=
|
||||
|
@ -102,7 +102,7 @@ public class MMChart extends javax.swing.JPanel {
|
||||
add(xLegend, gbConstraints);
|
||||
|
||||
OHLCChartPainter p;
|
||||
OHLCData mydata = stock.getOHLCdata(60*20);
|
||||
OHLCData mydata = stock.getOHLCdata(60000);
|
||||
|
||||
|
||||
|
||||
|
@ -151,7 +151,7 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
|
||||
this.yLegend.setChartDef(chartDef);
|
||||
|
||||
OHLCChartPainter p;
|
||||
mydata = Globals.se.getOHLCdata(Globals.se.getDefaultStock(),60000 * 20);
|
||||
mydata = Globals.se.getOHLCdata(Globals.se.getDefaultStock(),60000);
|
||||
|
||||
this.xScrollBar.setMaximum(0);
|
||||
|
||||
|
@ -34,6 +34,7 @@ import sesim.OHLCDataItem;
|
||||
|
||||
/**
|
||||
* Paints an x-legend for OHLC charts
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class XLegendPainter extends OHLCChartPainter {
|
||||
@ -41,29 +42,26 @@ public class XLegendPainter extends OHLCChartPainter {
|
||||
private String getTimeStrAt(OHLCData data, int unit) {
|
||||
|
||||
int fs = data.getFrameSize();
|
||||
return sesim.Scheduler.formatTimeMillis(0 + unit * fs);
|
||||
return sesim.Scheduler.formatTimeMillis(0 + (long)unit * (long)fs);
|
||||
|
||||
}
|
||||
|
||||
int big_tick = 10;
|
||||
|
||||
int big_tick = 2;
|
||||
int y = 0;
|
||||
|
||||
@Override
|
||||
public void drawChart(Graphics2D g, ChartPanel p, ChartDef def)
|
||||
{
|
||||
OHLCData data = getData();
|
||||
if (data ==null)
|
||||
return;
|
||||
|
||||
public void drawChart(Graphics2D g, ChartPanel p, ChartDef def) {
|
||||
|
||||
init(g);
|
||||
|
||||
|
||||
Dimension size = p.getSize();
|
||||
|
||||
|
||||
int first_bar = getFirstBar(p);
|
||||
|
||||
|
||||
int n;
|
||||
int x;
|
||||
for (n = first_bar, x = 0; x < size.width; x += em_size * def.x_unit_width) {
|
||||
if (n % big_tick == 1) {
|
||||
if (n % big_tick == 0) {
|
||||
g.drawLine((int) x, y, (int) x, y + em_size);
|
||||
String text;
|
||||
text = getTimeStrAt(data, n);
|
||||
|
Loading…
Reference in New Issue
Block a user