本文整理汇总了Java中org.swtchart.IAxisSet.getXAxis方法的典型用法代码示例。如果您正苦于以下问题:Java IAxisSet.getXAxis方法的具体用法?Java IAxisSet.getXAxis怎么用?Java IAxisSet.getXAxis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.swtchart.IAxisSet
的用法示例。
在下文中一共展示了IAxisSet.getXAxis方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateCategories
import org.swtchart.IAxisSet; //导入方法依赖的package包/类
/**
* Makes the chart show category labels or not.
*/
private void updateCategories(){
if (chart != null){
IAxisSet axisSet = chart.getAxisSet();
if (axisSet != null) {
IAxis xAxis = axisSet.getXAxis(0);
if (xAxis != null) {
String[] series = xAxis.getCategorySeries();
if (series != null) {
boolean enoughSpace = chart.getPlotArea().getSize().x / series.length >= MIN_CATEGORY_WIDTH;
xAxis.enableCategory(enoughSpace);
xAxis.getTick().setVisible(enoughSpace);
}
}
}
}
}
示例2: updateCategories
import org.swtchart.IAxisSet; //导入方法依赖的package包/类
/**
* Makes the chart show category labels or not.
*/
private void updateCategories(){
if (chart != null){
IAxisSet axisSet = chart.getAxisSet();
if (axisSet != null) {
IAxis xAxis = axisSet.getXAxis(0);
if (xAxis != null) {
String[] series = xAxis.getCategorySeries();
if (series != null) {
root.setRedraw(false);
boolean enoughSpace = chart.getPlotArea().getSize().x / series.length >= MIN_CATEGORY_WIDTH;
xAxis.enableCategory(true);
xAxis.getTick().setVisible(true);
xAxis.getTick().setTickLabelAngle(enoughSpace ? 45 : 90);
root.setRedraw(true);
}
}
}
}
}
示例3: coindistro
import org.swtchart.IAxisSet; //导入方法依赖的package包/类
public void coindistro()
{
mainchart.getTitle().setText("Coin Distribution");
int sel = coinlist.getSelectionIndex();
if (sel != -1)
{
Map<String, Integer> exchcount = new HashMap<String, Integer>();
for (int i = 0; i < exchangeNames.size(); i++)
exchcount.put(exchangeNames.get(i), 0);
String select = coinlist.getItem(sel);
java.util.List<Coin> coins = common.getCommonCoinRow(select.substring(0, select.indexOf(" (")));
for (int coin = 0; coin < coins.size(); coin++)
exchcount.put(coins.get(coin).getExchange(), exchcount.get(coins.get(coin).getExchange()) + 1);
double [] yseries = new double[exchcount.size()];
//Create a string array containing the keys to exchcount and sort them
String [] keys = exchcount.keySet().toArray(new String [exchcount.size()]);
Arrays.sort(keys);
for (int k = 0; k < keys.length; k++)
yseries[k] = exchcount.get(keys[k]);
//Apply series to the chart
ISeriesSet seriesset = mainchart.getSeriesSet();
IBarSeries series = (IBarSeries) seriesset.createSeries(SeriesType.BAR, "Coin");
//Check if user wants to display chart labels
series.getLabel().setFormat("#");
series.getLabel().setVisible(displayChartLabel);
series.setYSeries(yseries);
series.setBarColor(mainFormDark);
series.setBarPadding(40);
IAxisSet xset = mainchart.getAxisSet();
IAxis xAxis = xset.getXAxis(0);
String [] names = exchangeNames.toArray(new String[exchangeNames.size()]);
//Angle x axis text if necessary
if (names.length > 9)
xAxis.getTick().setTickLabelAngle(30);
else if (names.length > 7)
xAxis.getTick().setTickLabelAngle(25);
else
xAxis.getTick().setTickLabelAngle(0);
xAxis.setCategorySeries(names);
xAxis.enableCategory(true);
//Color the data
series.getLabel().setForeground(textColor);
//Adjust the range so all the data can be seen at the same time
mainchart.getAxisSet().adjustRange();
}
mainchart.redraw(); //visually update the chart
}
示例4: setChartSeries
import org.swtchart.IAxisSet; //导入方法依赖的package包/类
/**
* Updates the chart with a new matrix
* @param matrix
*/
private void setChartSeries(PrecisionRecallMatrix matrix) {
// Init data
String[] xAxisLabels = new String[matrix.getConfidenceThresholds().length];
double[] ySeriesPrecision = new double[matrix.getConfidenceThresholds().length];
double[] ySeriesRecall = new double[matrix.getConfidenceThresholds().length];
double[] ySeriesFscore = new double[matrix.getConfidenceThresholds().length];
for (int i = 0; i < xAxisLabels.length; i++) {
xAxisLabels[i] = SWTUtil.getPrettyString(matrix.getConfidenceThresholds()[i] * 100d);
ySeriesPrecision[i] = matrix.getPrecision()[i] * 100d;
ySeriesRecall[i] = matrix.getRecall()[i] * 100d;
ySeriesFscore[i] = matrix.getFscore()[i] * 100d;
}
chart.setRedraw(false);
ISeriesSet seriesSet = chart.getSeriesSet();
// Precision
ILineSeries series1 = (ILineSeries) seriesSet.createSeries(SeriesType.LINE, TEXT_PRECISION);
series1.getLabel().setVisible(false);
series1.getLabel().setFont(chart.getFont());
series1.setLineColor(Display.getDefault().getSystemColor(SWT.COLOR_RED));
series1.setYSeries(ySeriesPrecision);
series1.setAntialias(SWT.ON);
series1.setSymbolType(PlotSymbolType.NONE);
series1.enableArea(true);
// Recall
ILineSeries series2 = (ILineSeries) seriesSet.createSeries(SeriesType.LINE, TEXT_RECALL);
series2.getLabel().setVisible(false);
series2.getLabel().setFont(chart.getFont());
series2.setLineColor(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
series2.setYSeries(ySeriesRecall);
series2.setSymbolType(PlotSymbolType.NONE);
series2.enableArea(true);
// F-Score
ILineSeries series3 = (ILineSeries) seriesSet.createSeries(SeriesType.LINE, TEXT_F_SCORE);
series3.getLabel().setVisible(false);
series3.getLabel().setFont(chart.getFont());
series3.setLineColor(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GREEN));
series3.setYSeries(ySeriesFscore);
series3.setSymbolType(PlotSymbolType.NONE);
series3.enableArea(true);
seriesSet.bringToFront(TEXT_RECALL);
chart.getLegend().setVisible(true);
chart.getLegend().setPosition(SWT.TOP);
IAxisSet axisSet = chart.getAxisSet();
IAxis yAxis = axisSet.getYAxis(0);
yAxis.setRange(new Range(0d, 100d));
IAxis xAxis = axisSet.getXAxis(0);
xAxis.setCategorySeries(xAxisLabels);
xAxis.adjustRange();
updateCategories();
chart.setRedraw(true);
chart.updateLayout();
chart.update();
chart.redraw();
}