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=true
|
||||||
annotation.processing.enabled.in.editor=false
|
annotation.processing.enabled.in.editor=false
|
||||||
annotation.processing.processors.list=
|
annotation.processing.processors.list=
|
||||||
|
@ -102,7 +102,7 @@ public class MMChart extends javax.swing.JPanel {
|
|||||||
add(xLegend, gbConstraints);
|
add(xLegend, gbConstraints);
|
||||||
|
|
||||||
OHLCChartPainter p;
|
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);
|
this.yLegend.setChartDef(chartDef);
|
||||||
|
|
||||||
OHLCChartPainter p;
|
OHLCChartPainter p;
|
||||||
mydata = Globals.se.getOHLCdata(Globals.se.getDefaultStock(),60000 * 20);
|
mydata = Globals.se.getOHLCdata(Globals.se.getDefaultStock(),60000);
|
||||||
|
|
||||||
this.xScrollBar.setMaximum(0);
|
this.xScrollBar.setMaximum(0);
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ import sesim.OHLCDataItem;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Paints an x-legend for OHLC charts
|
* 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 {
|
||||||
@ -41,18 +42,15 @@ public class XLegendPainter extends OHLCChartPainter {
|
|||||||
private String getTimeStrAt(OHLCData data, int unit) {
|
private String getTimeStrAt(OHLCData data, int unit) {
|
||||||
|
|
||||||
int fs = data.getFrameSize();
|
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;
|
int y = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawChart(Graphics2D g, ChartPanel p, ChartDef def)
|
public void drawChart(Graphics2D g, ChartPanel p, ChartDef def) {
|
||||||
{
|
|
||||||
OHLCData data = getData();
|
|
||||||
if (data ==null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
init(g);
|
init(g);
|
||||||
|
|
||||||
@ -63,7 +61,7 @@ public class XLegendPainter extends OHLCChartPainter {
|
|||||||
int n;
|
int n;
|
||||||
int x;
|
int x;
|
||||||
for (n = first_bar, x = 0; x < size.width; x += em_size * def.x_unit_width) {
|
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);
|
g.drawLine((int) x, y, (int) x, y + em_size);
|
||||||
String text;
|
String text;
|
||||||
text = getTimeStrAt(data, n);
|
text = getTimeStrAt(data, n);
|
||||||
|
Loading…
Reference in New Issue
Block a user