Added "ministeps" to y legend

This commit is contained in:
7u83 2018-01-20 21:23:05 +01:00
parent 29c5a95811
commit fc06570e13
2 changed files with 28 additions and 26 deletions

View File

@ -1,4 +1,4 @@
#Sat, 20 Jan 2018 00:00:54 +0100
#Sat, 20 Jan 2018 21:21:05 +0100
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=

View File

@ -26,6 +26,7 @@
package chart.painter;
import chart.Chart;
import java.awt.Color;
import sesim.ChartDef;
import sesim.ChartPanel;
import java.awt.Dimension;
@ -82,27 +83,28 @@ public class YLegendPainter extends OHLCChartPainter {
int c_font_height = g.getFontMetrics().getHeight();
float lastyv = firstyv-stepsize10;
for (float yv = firstyv; yv < minmax.getMax(false); yv += stepsize10) {
float y = this.getY(yv);
float y;
float ministep = stepsize10/10.0f;
for (float yv10 = lastyv+ministep; yv10 < yv; yv10 += ministep) {
y = this.getY(yv10);
Color oc = g.getColor();
g.setColor(Color.RED);
g.drawLine(0, (int) y, em_size/2, (int) y);
g.setColor(oc);
}
y = this.getY(yv);
g.drawLine(0, (int) y, em_size, (int) y);
g.drawString(String.format("%.2f", yv), em_size * 1.5f, y + c_font_height / 3);
lastyv = yv;
}
// this.getRoundNumber(90);
/* float ydiff = y1 - y2;
int c_font_height = g.getFontMetrics().getHeight();
for (int yp = (int) y2; yp < y1; yp += em_size * 3) {
g.drawLine(0, yp, em_size, yp);
double v1 = getValAtY(yp);
g.drawString(String.format("%.2f", v1), em_size * 1.5f, yp + c_font_height / 3);
}
double v1, v2;
*/
}
@Override