本文整理汇总了Java中org.swtchart.Chart类的典型用法代码示例。如果您正苦于以下问题:Java Chart类的具体用法?Java Chart怎么用?Java Chart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Chart类属于org.swtchart包,在下文中一共展示了Chart类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: putOnAxis
import org.swtchart.Chart; //导入依赖的package包/类
private void putOnAxis(final Chart chart, final ILineSeries newSeries,
final Unit<?> newUnits)
{
final String unitStr = newUnits.toString();
// special case. at start we just have an empty y axis
final IAxis[] yAxes = chart.getAxisSet().getYAxes();
if (yAxes.length == 1 && yAxes[0].getTitle().getText() == "")
{
// ok, we're only just opened. Use this one
yAxes[0].getTitle().setText(unitStr);
newSeries.setYAxisId(yAxes[0].getId());
}
else
{
int leftCount = 0;
int rightCount = 0;
// clear the axis id, we're going to rely on it
final int INVALID_ID = -10000;
newSeries.setYAxisId(INVALID_ID);
// ok, work through the axes
for (final IAxis t : yAxes)
{
if (t.getTitle().getText().equals(unitStr))
{
// ok, this will do
newSeries.setYAxisId(t.getId());
}
else
{
// just keep track of the count
switch (t.getPosition())
{
case Primary:
leftCount++;
break;
case Secondary:
default:
rightCount++;
break;
}
}
}
// did we store it?
if (newSeries.getYAxisId() == INVALID_ID)
{
final Position toUse;
// choose the side with the fewest, or the x if none.
if (leftCount == 0)
{
toUse = Position.Primary;
}
else if (leftCount > rightCount)
{
toUse = Position.Secondary;
}
else
{
toUse = Position.Primary;
}
// create the axis
final int newAxisId = chart.getAxisSet().createYAxis();
final IAxis newAxis = chart.getAxisSet().getYAxis(newAxisId);
newAxis.getTitle().setText(unitStr);
newAxis.setPosition(toUse);
// and tell the series to use it
newSeries.setYAxisId(newAxisId);
}
}
}
开发者ID:debrief,项目名称:limpet,代码行数:76,代码来源:XyPlotView.java
注:本文中的org.swtchart.Chart类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论