本文整理汇总了Java中info.monitorenter.gui.chart.Chart2D.getAxisTickPainter方法的典型用法代码示例。如果您正苦于以下问题:Java Chart2D.getAxisTickPainter方法的具体用法?Java Chart2D.getAxisTickPainter怎么用?Java Chart2D.getAxisTickPainter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类info.monitorenter.gui.chart.Chart2D
的用法示例。
在下文中一共展示了Chart2D.getAxisTickPainter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintAxisXBottom
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Internally paints this axis in the case it is assigned as an x axis on
* bottom of the corresponding chart.
* <p>
*
* @param g2d
* the graphics context to use.
*/
private void paintAxisXBottom(final Graphics g2d) {
final Chart2D chart = this.getAccessor().getChart();
int tmp = 0;
final FontMetrics fontdim = g2d.getFontMetrics();
final int fontheight = fontdim.getHeight();
final int xAxisStart = chart.getXChartStart();
final int xAxisEnd = chart.getXChartEnd();
final int yAxisEnd = chart.getYChartEnd();
final int rangexPx = xAxisEnd - xAxisStart;
final int yAxisLine = this.getPixelYTop();
g2d.drawLine(xAxisStart, yAxisLine, xAxisEnd, yAxisLine);
// drawing the x title :
this.paintTitle(g2d);
// drawing tick - scale, corresponding values, grid and conditional unit
// label:
if (this.isPaintScale() || this.isPaintGrid()) {
final IAxisTickPainter tickPainter = chart.getAxisTickPainter();
tmp = 0;
final List<LabeledValue> labels = this.m_axisScalePolicy.getScaleValues(g2d, this);
for (final LabeledValue label : labels) {
tmp = xAxisStart + (int) (label.getValue() * rangexPx);
// true -> is bottom axis:
if (this.isPaintScale()) {
tickPainter.paintXTick(tmp, yAxisLine, label.isMajorTick(), true, g2d);
tickPainter.paintXLabel(tmp, yAxisLine + fontheight, label.getLabel(), g2d);
}
if (this.isPaintGrid()) {
// do not paint over the axis
if (tmp != xAxisStart) {
g2d.setColor(chart.getGridColor());
g2d.drawLine(tmp, yAxisLine - 1, tmp, yAxisEnd);
g2d.setColor(chart.getForeground());
}
}
}
}
// unit-labeling
g2d.drawString(this.getFormatter().getUnit().getUnitName(), xAxisEnd, yAxisLine + 4
+ fontdim.getHeight() * 2);
}
示例2: paintAxisXTop
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Internally paints this axis in the case it is assigned as an x axis on top
* of the corresponding chart.
* <p>
*
* @param g2d
* the graphics context to use.
*/
private void paintAxisXTop(final Graphics g2d) {
final Chart2D chart = this.getAccessor().getChart();
int tmp = 0;
final FontMetrics fontdim = g2d.getFontMetrics();
final int xAxisStart = chart.getXChartStart();
final int xAxisEnd = chart.getXChartEnd();
final int yAxisStart = chart.getYChartStart();
final int rangexPx = xAxisEnd - xAxisStart;
// 1.2) x axis top:
final int yAxisLine = this.getPixelYBottom();
g2d.drawLine(xAxisStart, yAxisLine, xAxisEnd, yAxisLine);
// drawing the x title :
this.paintTitle(g2d);
// drawing tick - scale, corresponding values, grid and conditional unit
// label:
if (this.isPaintScale()||this.isPaintGrid()) {
// first for x- angle.
tmp = 0;
final IAxisTickPainter tickPainter = chart.getAxisTickPainter();
final int majorTickLength = tickPainter.getMajorTickLength();
final List<LabeledValue> labels = this.m_axisScalePolicy.getScaleValues(g2d, this);
for (final LabeledValue label : labels) {
tmp = xAxisStart + (int) (label.getValue() * rangexPx);
if (this.isPaintScale()) {
// 2nd boolean false -> is not bottom axis (top):
tickPainter.paintXTick(tmp, yAxisLine, label.isMajorTick(), false, g2d);
tickPainter.paintXLabel(tmp, yAxisLine - majorTickLength, label.getLabel(), g2d);
}
if (this.isPaintGrid()) {
// do not paint over the axis:
if (tmp != xAxisStart) {
g2d.setColor(chart.getGridColor());
g2d.drawLine(tmp, yAxisLine + 1, tmp, yAxisStart);
g2d.setColor(chart.getForeground());
}
}
}
// unit-labeling
g2d.drawString(this.getFormatter().getUnit().getUnitName(), xAxisEnd, yAxisLine - 4
- fontdim.getHeight());
}
}
示例3: paintAxisYLeft
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Internally paints this axis in the case it is assigned as a y axis on the
* left side of the corresponding chart.
* <p>
*
* @param g2d
* the graphics context to use.
*/
private void paintAxisYLeft(final Graphics g2d) {
final Chart2D chart = this.getAccessor().getChart();
int tmp = 0;
final FontMetrics fontdim = g2d.getFontMetrics();
final int xAxisStart = chart.getXChartStart();
final int xAxisEnd = chart.getXChartEnd();
final int yAxisStart = chart.getYChartStart();
final int yAxisEnd = chart.getYChartEnd();
final int rangeyPx = yAxisStart - yAxisEnd;
final int xAxisLine = this.getPixelXRight();
g2d.drawLine(xAxisLine, yAxisStart, xAxisLine, yAxisEnd);
// drawing the y title :
this.paintTitle(g2d);
// drawing tick - scale, corresponding values, grid and conditional unit
// label:
if (this.isPaintScale() || this.isPaintGrid()) {
final IAxisTickPainter tickPainter = chart.getAxisTickPainter();
final int majorTickLength = tickPainter.getMajorTickLength();
final List<LabeledValue> labels = this.m_axisScalePolicy.getScaleValues(g2d, this);
for (final LabeledValue label : labels) {
tmp = yAxisStart - (int) (label.getValue() * rangeyPx);
if (this.isPaintScale()) {
// true -> is left y axis:
tickPainter.paintYTick(xAxisLine, tmp, label.isMajorTick(), true, g2d);
tickPainter.paintYLabel(xAxisLine - majorTickLength
- fontdim.stringWidth(label.getLabel()), tmp, label.getLabel(), g2d);
}
if (this.isPaintGrid()) {
if (tmp != yAxisStart) {
g2d.setColor(chart.getGridColor());
g2d.drawLine(xAxisStart + 1, tmp, xAxisEnd, tmp);
g2d.setColor(chart.getForeground());
}
}
}
// unit-labeling
final String unitName = this.getFormatter().getUnit().getUnitName();
g2d.drawString(unitName, 4, yAxisEnd);
}
}
示例4: paintAxisYRight
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Internally paints this axis in the case it is assigned as a y axis on the
* right side of the corresponding chart.
* <p>
*
* @param g2d
* the graphics context to use.
*/
private void paintAxisYRight(final Graphics g2d) {
final Chart2D chart = this.getAccessor().getChart();
int tmp = 0;
final FontMetrics fontdim = g2d.getFontMetrics();
final int xAxisStart = chart.getXChartStart();
final int xAxisEnd = chart.getXChartEnd();
final int yAxisStart = chart.getYChartStart();
final int yAxisEnd = chart.getYChartEnd();
final int rangeyPx = yAxisStart - yAxisEnd;
final int xAxisLine = this.getPixelXLeft();
g2d.drawLine(xAxisLine, yAxisStart, xAxisLine, yAxisEnd);
// drawing the y title :
this.paintTitle(g2d);
// drawing tick - scale, corresponding values, grid and conditional unit
// label:
if (this.isPaintScale() || this.isPaintGrid()) {
// then for y- angle.
final IAxisTickPainter tickPainter = chart.getAxisTickPainter();
final List<LabeledValue> labels = this.m_axisScalePolicy.getScaleValues(g2d, this);
final int tickWidth = tickPainter.getMajorTickLength() + 4;
for (final LabeledValue label : labels) {
tmp = yAxisStart - (int) (label.getValue() * rangeyPx);
if (this.isPaintScale()) {
// false -> is right y axis:
tickPainter.paintYTick(xAxisLine, tmp, label.isMajorTick(), false, g2d);
tickPainter.paintYLabel(xAxisLine + tickWidth, tmp, label.getLabel(), g2d);
}
if (this.isPaintGrid()) {
// do not paint over the axis:
if (tmp != yAxisStart) {
g2d.setColor(chart.getGridColor());
g2d.drawLine(xAxisStart + 1, tmp, xAxisEnd, tmp);
g2d.setColor(chart.getForeground());
}
}
}
// unit-labeling
final String unitName = this.getFormatter().getUnit().getUnitName();
g2d.drawString(unitName, (int) chart.getSize().getWidth()
- fontdim.charsWidth(unitName.toCharArray(), 0, unitName.length()) - 4, yAxisEnd);
}
}