本文整理汇总了Java中de.erichseifert.gral.plots.PiePlot.PieSliceRenderer.setValueVisible方法的典型用法代码示例。如果您正苦于以下问题:Java PieSliceRenderer.setValueVisible方法的具体用法?Java PieSliceRenderer.setValueVisible怎么用?Java PieSliceRenderer.setValueVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.erichseifert.gral.plots.PiePlot.PieSliceRenderer
的用法示例。
在下文中一共展示了PieSliceRenderer.setValueVisible方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SimplePiePlot
import de.erichseifert.gral.plots.PiePlot.PieSliceRenderer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public SimplePiePlot() {
// Create data
DataTable data = new DataTable(Integer.class);
for (int i = 0; i < SAMPLE_COUNT; i++) {
int val = random.nextInt(8) + 2;
data.add((random.nextDouble() <= 0.15) ? -val : val);
}
// Create new pie plot
PiePlot plot = new PiePlot(data);
// Format plot
plot.getTitle().setText(getDescription());
// Change relative size of pie
plot.setRadius(0.9);
// Display a legend
plot.setLegendVisible(true);
// Add some margin to the plot area
plot.setInsets(new Insets2D.Double(20.0, 40.0, 40.0, 40.0));
PieSliceRenderer pointRenderer =
(PieSliceRenderer) plot.getPointRenderer(data);
// Change relative size of inner region
pointRenderer.setInnerRadius(0.4);
// Change the width of gaps between segments
pointRenderer.setGap(0.2);
// Change the colors
LinearGradient colors = new LinearGradient(COLOR1, COLOR2);
pointRenderer.setColor(colors);
// Show labels
pointRenderer.setValueVisible(true);
pointRenderer.setValueColor(Color.WHITE);
pointRenderer.setValueFont(Font.decode(null).deriveFont(Font.BOLD));
// Add plot to Swing component
add(new InteractivePanel(plot), BorderLayout.CENTER);
}
示例2: SimplePiePlot
import de.erichseifert.gral.plots.PiePlot.PieSliceRenderer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public SimplePiePlot() {
// Create data
DataTable data = new DataTable(Integer.class);
for (int i = 0; i < SAMPLE_COUNT; i++) {
int val = random.nextInt(8) + 2;
data.add((random.nextDouble() <= 0.15) ? -val : val);
}
DataSource pieData = PiePlot.createPieData(data);
// Create new pie plot
PiePlot plot = new PiePlot(pieData);
// Format plot
plot.getTitle().setText(getDescription());
// Change relative size of pie
plot.setRadius(0.9);
// Display a legend
plot.setLegendVisible(true);
// Add some margin to the plot area
plot.setInsets(new Insets2D.Double(20.0, 40.0, 40.0, 40.0));
PieSliceRenderer pointRenderer =
(PieSliceRenderer) plot.getPointRenderer(pieData);
// Change relative size of inner region
pointRenderer.setInnerRadius(0.4);
// Change the width of gaps between segments
pointRenderer.setGap(0.2);
// Change the colors
LinearGradient colors = new LinearGradient(COLOR1, COLOR2);
pointRenderer.setColor(colors);
// Show labels
pointRenderer.setValueVisible(true);
pointRenderer.setValueColor(Color.WHITE);
pointRenderer.setValueFont(Font.decode(null).deriveFont(Font.BOLD));
// Add plot to Swing component
add(new InteractivePanel(plot), BorderLayout.CENTER);
}
示例3: SimplePiePlot
import de.erichseifert.gral.plots.PiePlot.PieSliceRenderer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public SimplePiePlot() {
// Create data
DataTable data = new DataTable(Integer.class);
for (int i = 0; i < SAMPLE_COUNT; i++) {
int val = random.nextInt(8) + 2;
int sign = (random.nextDouble() <= 0.15) ? -1 : 1;
System.out.println("SimplePiePlot.SimplePiePlot(" + val + ", " + sign + ")");
data.add(val);
}
// Create new pie plot
PiePlot plot = new PiePlot(data);
// Format plot
plot.getTitle().setText(getDescription());
// Change relative size of pie
plot.setRadius(0.9);
// Display a legend
plot.setLegendVisible(true);
// Add some margin to the plot area
plot.setInsets(new Insets2D.Double(20.0, 40.0, 40.0, 40.0));
PieSliceRenderer pointRenderer =
(PieSliceRenderer) plot.getPointRenderer(data);
// Change relative size of inner region
pointRenderer.setInnerRadius(0.4);
// Change the width of gaps between segments
pointRenderer.setGap(0.2);
// Change the colors
LinearGradient colors = new LinearGradient(COLOR1, COLOR2);
pointRenderer.setColor(colors);
// Show labels
pointRenderer.setValueVisible(true);
pointRenderer.setValueColor(Color.WHITE);
pointRenderer.setValueFont(Font.decode(null).deriveFont(Font.BOLD));
// Add plot to Swing component
add(new InteractivePanel(plot), BorderLayout.CENTER);
}