本文整理汇总了Java中org.jfree.chart.util.AttrStringUtils类的典型用法代码示例。如果您正苦于以下问题:Java AttrStringUtils类的具体用法?Java AttrStringUtils怎么用?Java AttrStringUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttrStringUtils类属于org.jfree.chart.util包,在下文中一共展示了AttrStringUtils类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findMaximumTickLabelHeight
import org.jfree.chart.util.AttrStringUtils; //导入依赖的package包/类
/**
* A utility method for determining the height of the tallest tick label.
*
* @param ticks the ticks.
* @param g2 the graphics device.
* @param drawArea the area within which the plot and axes should be drawn.
* @param vertical a flag that indicates whether or not the tick labels
* are 'vertical'.
*
* @return The height of the tallest tick label.
*/
protected double findMaximumTickLabelHeight(List ticks, Graphics2D g2,
Rectangle2D drawArea, boolean vertical) {
RectangleInsets insets = getTickLabelInsets();
Font font = getTickLabelFont();
g2.setFont(font);
double maxHeight = 0.0;
if (vertical) {
FontMetrics fm = g2.getFontMetrics(font);
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
Tick tick = (Tick) iterator.next();
Rectangle2D labelBounds = null;
if (tick instanceof LogTick) {
LogTick lt = (LogTick) tick;
if (lt.getAttributedLabel() != null) {
labelBounds = AttrStringUtils.getTextBounds(
lt.getAttributedLabel(), g2);
}
} else if (tick.getText() != null) {
labelBounds = TextUtilities.getTextBounds(
tick.getText(), g2, fm);
}
if (labelBounds != null && labelBounds.getWidth()
+ insets.getTop() + insets.getBottom() > maxHeight) {
maxHeight = labelBounds.getWidth()
+ insets.getTop() + insets.getBottom();
}
}
} else {
LineMetrics metrics = font.getLineMetrics("ABCxyz",
g2.getFontRenderContext());
maxHeight = metrics.getHeight()
+ insets.getTop() + insets.getBottom();
}
return maxHeight;
}
开发者ID:mdzio,项目名称:ccu-historian,代码行数:50,代码来源:ValueAxis.java
示例2: findMaximumTickLabelWidth
import org.jfree.chart.util.AttrStringUtils; //导入依赖的package包/类
/**
* A utility method for determining the width of the widest tick label.
*
* @param ticks the ticks.
* @param g2 the graphics device.
* @param drawArea the area within which the plot and axes should be drawn.
* @param vertical a flag that indicates whether or not the tick labels
* are 'vertical'.
*
* @return The width of the tallest tick label.
*/
protected double findMaximumTickLabelWidth(List ticks, Graphics2D g2,
Rectangle2D drawArea, boolean vertical) {
RectangleInsets insets = getTickLabelInsets();
Font font = getTickLabelFont();
double maxWidth = 0.0;
if (!vertical) {
FontMetrics fm = g2.getFontMetrics(font);
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
Tick tick = (Tick) iterator.next();
Rectangle2D labelBounds = null;
if (tick instanceof LogTick) {
LogTick lt = (LogTick) tick;
if (lt.getAttributedLabel() != null) {
labelBounds = AttrStringUtils.getTextBounds(
lt.getAttributedLabel(), g2);
}
} else if (tick.getText() != null) {
labelBounds = TextUtilities.getTextBounds(tick.getText(),
g2, fm);
}
if (labelBounds != null
&& labelBounds.getWidth() + insets.getLeft()
+ insets.getRight() > maxWidth) {
maxWidth = labelBounds.getWidth()
+ insets.getLeft() + insets.getRight();
}
}
} else {
LineMetrics metrics = font.getLineMetrics("ABCxyz",
g2.getFontRenderContext());
maxWidth = metrics.getHeight()
+ insets.getTop() + insets.getBottom();
}
return maxWidth;
}
开发者ID:mdzio,项目名称:ccu-historian,代码行数:50,代码来源:ValueAxis.java
示例3: estimateMaximumTickLabelWidth
import org.jfree.chart.util.AttrStringUtils; //导入依赖的package包/类
/**
* Estimates the maximum width of the tick labels, assuming the specified
* tick unit is used.
* <P>
* Rather than computing the string bounds of every tick on the axis, we
* just look at two values: the lower bound and the upper bound for the
* axis. These two values will usually be representative.
*
* @param g2 the graphics device.
* @param unit the tick unit to use for calculation.
*
* @return The estimated maximum width of the tick labels.
*
* @since 1.0.7
*/
protected double estimateMaximumTickLabelWidth(Graphics2D g2,
TickUnit unit) {
RectangleInsets tickLabelInsets = getTickLabelInsets();
double result = tickLabelInsets.getLeft() + tickLabelInsets.getRight();
if (isVerticalTickLabels()) {
// all tick labels have the same width (equal to the height of the
// font)...
FontRenderContext frc = g2.getFontRenderContext();
LineMetrics lm = getTickLabelFont().getLineMetrics("0", frc);
result += lm.getHeight();
}
else {
// look at lower and upper bounds...
Range range = getRange();
double lower = range.getLowerBound();
double upper = range.getUpperBound();
AttributedString lowerStr = createTickLabel(lower);
AttributedString upperStr = createTickLabel(upper);
double w1 = AttrStringUtils.getTextBounds(lowerStr, g2).getWidth();
double w2 = AttrStringUtils.getTextBounds(upperStr, g2).getWidth();
result += Math.max(w1, w2);
}
return result;
}
开发者ID:mdzio,项目名称:ccu-historian,代码行数:42,代码来源:LogAxis.java
示例4: findMaximumTickLabelHeight
import org.jfree.chart.util.AttrStringUtils; //导入依赖的package包/类
/**
* A utility method for determining the height of the tallest tick label.
*
* @param ticks the ticks.
* @param g2 the graphics device.
* @param drawArea the area within which the plot and axes should be drawn.
* @param vertical a flag that indicates whether or not the tick labels
* are 'vertical'.
*
* @return The height of the tallest tick label.
*/
protected double findMaximumTickLabelHeight(List ticks, Graphics2D g2,
Rectangle2D drawArea, boolean vertical) {
RectangleInsets insets = getTickLabelInsets();
Font font = getTickLabelFont();
g2.setFont(font);
double maxHeight = 0.0;
if (vertical) {
FontMetrics fm = g2.getFontMetrics(font);
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
Tick tick = (Tick) iterator.next();
Rectangle2D labelBounds = null;
if (tick instanceof LogTick) {
LogTick lt = (LogTick) tick;
if (lt.getAttributedLabel() != null) {
labelBounds = AttrStringUtils.getTextBounds(
lt.getAttributedLabel(), g2);
}
} else if (tick.getText() != null) {
labelBounds = TextUtils.getTextBounds(
tick.getText(), g2, fm);
}
if (labelBounds != null && labelBounds.getWidth()
+ insets.getTop() + insets.getBottom() > maxHeight) {
maxHeight = labelBounds.getWidth()
+ insets.getTop() + insets.getBottom();
}
}
} else {
LineMetrics metrics = font.getLineMetrics("ABCxyz",
g2.getFontRenderContext());
maxHeight = metrics.getHeight()
+ insets.getTop() + insets.getBottom();
}
return maxHeight;
}
开发者ID:jfree,项目名称:jfreechart,代码行数:50,代码来源:ValueAxis.java
示例5: findMaximumTickLabelWidth
import org.jfree.chart.util.AttrStringUtils; //导入依赖的package包/类
/**
* A utility method for determining the width of the widest tick label.
*
* @param ticks the ticks.
* @param g2 the graphics device.
* @param drawArea the area within which the plot and axes should be drawn.
* @param vertical a flag that indicates whether or not the tick labels
* are 'vertical'.
*
* @return The width of the tallest tick label.
*/
protected double findMaximumTickLabelWidth(List ticks, Graphics2D g2,
Rectangle2D drawArea, boolean vertical) {
RectangleInsets insets = getTickLabelInsets();
Font font = getTickLabelFont();
double maxWidth = 0.0;
if (!vertical) {
FontMetrics fm = g2.getFontMetrics(font);
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
Tick tick = (Tick) iterator.next();
Rectangle2D labelBounds = null;
if (tick instanceof LogTick) {
LogTick lt = (LogTick) tick;
if (lt.getAttributedLabel() != null) {
labelBounds = AttrStringUtils.getTextBounds(
lt.getAttributedLabel(), g2);
}
} else if (tick.getText() != null) {
labelBounds = TextUtils.getTextBounds(tick.getText(),
g2, fm);
}
if (labelBounds != null
&& labelBounds.getWidth() + insets.getLeft()
+ insets.getRight() > maxWidth) {
maxWidth = labelBounds.getWidth()
+ insets.getLeft() + insets.getRight();
}
}
} else {
LineMetrics metrics = font.getLineMetrics("ABCxyz",
g2.getFontRenderContext());
maxWidth = metrics.getHeight()
+ insets.getTop() + insets.getBottom();
}
return maxWidth;
}
开发者ID:jfree,项目名称:jfreechart,代码行数:50,代码来源:ValueAxis.java
注:本文中的org.jfree.chart.util.AttrStringUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论