本文整理汇总了Java中org.knowm.xchart.BitmapEncoder类的典型用法代码示例。如果您正苦于以下问题:Java BitmapEncoder类的具体用法?Java BitmapEncoder怎么用?Java BitmapEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BitmapEncoder类属于org.knowm.xchart包,在下文中一共展示了BitmapEncoder类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convert
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
@Override
public PNGImageNotebookOutput convert(Object object) {
Chart chart = (Chart) object;
byte[] bt;
try {
bt = BitmapEncoder.getBitmapBytes(chart, BitmapEncoder.BitmapFormat.PNG);
Base64.getEncoder().encodeToString(bt);
return new PNGImageNotebookOutput(Base64.getEncoder().encodeToString(bt));
} catch (IOException ex) {
Logger.getLogger(ChartToPNGNotebookConverter.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
开发者ID:scijava,项目名称:scijava-jupyter-kernel,代码行数:18,代码来源:ChartToPNGNotebookConverter.java
示例2: plot99
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
private void plot99(List<Double> xData, List<Double> yData) throws IOException {
XYChart chart = buildCommonChart();
/*
* This shows only the > 90 percentile, so set te minimum
* accordingly.
*/
chart.getStyler().setXAxisMin(99.0);
// Series
XYSeries series = chart.addSeries(chartProperties.getSeriesName(), xData, yData);
series.setLineColor(XChartSeriesColors.BLUE);
series.setMarkerColor(Color.LIGHT_GRAY);
series.setMarker(SeriesMarkers.NONE);
series.setLineStyle(SeriesLines.SOLID);
BitmapEncoder.saveBitmap(chart, baseName + "_99.png", BitmapEncoder.BitmapFormat.PNG);
}
开发者ID:orpiske,项目名称:hdr-histogram-plotter,代码行数:21,代码来源:HdrPlotter.java
示例3: plot90
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
private void plot90(List<Double> xData, List<Double> yData) throws IOException {
XYChart chart = buildCommonChart();
/*
* This shows only the > 90 percentile, so set te minimum
* accordingly.
*/
chart.getStyler().setXAxisMin(90.0);
// Series
XYSeries series = chart.addSeries(chartProperties.getSeriesName(), xData, yData);
series.setLineColor(XChartSeriesColors.BLUE);
series.setMarkerColor(Color.LIGHT_GRAY);
series.setMarker(SeriesMarkers.NONE);
series.setLineStyle(SeriesLines.SOLID);
BitmapEncoder.saveBitmap(chart, baseName + "_90.png", BitmapEncoder.BitmapFormat.PNG);
}
开发者ID:orpiske,项目名称:hdr-histogram-plotter,代码行数:21,代码来源:HdrPlotter.java
示例4: plotAll
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
private void plotAll(List<Double> xData, List<Double> yData) throws IOException {
// Create Chart
XYChart chart = buildCommonChart();
/*
* This shows almost everything so set te minimum
* accordingly.
*/
chart.getStyler().setXAxisMin(5.0);
// Series
XYSeries series = chart.addSeries(chartProperties.getSeriesName(), xData, yData);
series.setLineColor(XChartSeriesColors.BLUE);
series.setMarkerColor(Color.LIGHT_GRAY);
series.setMarker(SeriesMarkers.NONE);
series.setLineStyle(SeriesLines.SOLID);
BitmapEncoder.saveBitmap(chart, baseName + "_all.png", BitmapEncoder.BitmapFormat.PNG);
}
开发者ID:orpiske,项目名称:hdr-histogram-plotter,代码行数:23,代码来源:HdrPlotter.java
示例5: saveChart
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
private void saveChart(XYChart chart, String filename) {
try {
String base = "src/test/charts";
String fullPath = String.format("%s/%s", base, filename);
File f = new File(fullPath);
f.getParentFile().mkdirs();
BitmapEncoder.saveBitmapWithDPI(chart, fullPath, BitmapEncoder.BitmapFormat.PNG, 300);
}
catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:supersede-project,项目名称:replan_optimizer_v2,代码行数:14,代码来源:AlgorithmPerformanceTest.java
示例6: afterReportInit
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
@Override
public void afterReportInit() throws JRScriptletException
{
try
{
XYChart xyChart = new XYChartBuilder()
.width(515)
.height(400)
.title("Fruits Order")
.xAxisTitle("Day of Week")
.yAxisTitle("Quantity (t)")
.build();
xyChart.addSeries("Apples", new double[] { 1, 3, 5}, new double[] {4, 10, 7});
xyChart.addSeries("Bananas", new double[] { 1, 2, 3, 4, 5}, new double[] {6, 8, 4, 4, 6});
xyChart.addSeries("Cherries", new double[] { 1, 3, 4, 5}, new double[] {2, 6, 1, 9});
XYStyler styler = xyChart.getStyler();
styler.setLegendPosition(Styler.LegendPosition.InsideNW);
styler.setAxisTitlesVisible(true);
styler.setDefaultSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Area);
styler.setChartBackgroundColor(Color.WHITE);
BufferedImage bufferedImage = BitmapEncoder.getBufferedImage(xyChart);
super.setVariableValue("ChartImage", bufferedImage);
}
catch(Exception e)
{
throw new JRScriptletException(e);
}
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:31,代码来源:XChartScriptlet.java
示例7: savePlotToFile
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
public void savePlotToFile(String path) {
try {
BitmapEncoder.saveBitmapWithDPI(getChart(), path, BitmapFormat.PNG, 500);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:cinquin,项目名称:mutinack,代码行数:8,代码来源:Histogram.java
示例8: saveChart
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
public static void saveChart(Chart chart, String name) {
try {
/* TODO: Maybe change output folder location */
BitmapEncoder.saveBitmapWithDPI(chart, "/tmp/" + name + ".png", BitmapEncoder.BitmapFormat.PNG, 300);
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:Ignotus,项目名称:torcsnet,代码行数:9,代码来源:Utils.java
示例9: chartGenerated
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
protected static void chartGenerated(CategoryChart chart, String writeLocation) throws IOException {
if (StringUtils.isNullOrEmpty(writeLocation)) {
new SwingWrapper<CategoryChart>(chart).displayChart();
System.in.read();
} else {
BitmapEncoder.saveBitmap(chart, writeLocation, BitmapFormat.PNG);
}
}
开发者ID:threadly,项目名称:threadly_benchmarks,代码行数:9,代码来源:DatabaseGraphPngExport.java
示例10: saveChart
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
public void saveChart(String fileName, BitmapFormat format) throws IOException {
for (String chart : this.charts.keySet()) {
BitmapEncoder.saveBitmap(this.charts.get(chart), fileName + "_" + chart, format);
}
}
开发者ID:jMetal,项目名称:jMetal,代码行数:6,代码来源:ChartContainer.java
示例11: copy
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
protected void copy(JRPrintImage image)
{
dataset.finishDataset();
JRComponentElement element = fillContext.getComponentElement();
XYChart xyChart = new XYChartBuilder()
.width(element.getWidth())
.height(element.getHeight())
.title(chartTitle == null ? "" : chartTitle)
.xAxisTitle(xAxisTitle == null ? "" : xAxisTitle)
.yAxisTitle(yAxisTitle == null ? "" : yAxisTitle)
.build();
XYStyler styler = xyChart.getStyler();
styler.setLegendPosition(Styler.LegendPosition.InsideNE);
styler.setAxisTitlesVisible(true);
styler.setDefaultSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Area);
styler.setChartBackgroundColor(element.getBackcolor() == null ? Color.WHITE : element.getBackcolor());
List<Comparable<?>> xySeriesNames = dataset.getXYSeriesNames();
Map<Comparable<?>, XYSeriesData> xySeriesMap = dataset.getXYSeriesMap();
if(xySeriesMap != null && !xySeriesMap.isEmpty())
{
int i = 0;
for(Comparable<?> name : xySeriesNames)
{
XYSeriesData data = xySeriesMap.get(name);
org.knowm.xchart.XYSeries series = xyChart.addSeries(name.toString(), data.getXData(), data.getYData());
Color color = data.getColor();
if(color != null)
{
series.setLineColor(color);
styler.getSeriesColors()[i] = color;
//series.setFillColor(color);
}
i++;
}
}
try
{
BufferedImage img = BitmapEncoder.getBufferedImage(xyChart);
Renderable renderable = RendererUtil
.getInstance(fillContext.getFiller().getJasperReportsContext())
.getRenderable(img, ImageTypeEnum.PNG, OnErrorTypeEnum.ERROR);
image.setRenderer(renderable);
}
catch(Exception e)
{
throw new JRRuntimeException(e);
}
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:52,代码来源:FillXYChart.java
示例12: saveBitmap
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
public static void saveBitmap(Chart chart, OutputStream targetStream, BitmapFormat bitmapFormat)
throws IOException {
BufferedImage bufferedImage = BitmapEncoder.getBufferedImage(chart);
ImageIO.write(bufferedImage, bitmapFormat.toString().toLowerCase(), targetStream);
}
开发者ID:kibertoad,项目名称:swampmachine,代码行数:6,代码来源:SwampPieChart.java
示例13: main
import org.knowm.xchart.BitmapEncoder; //导入依赖的package包/类
/**
* @param args Command line arguments.
* @throws SecurityException
* Invoking command:
java org.uma.jmetal.runner.multiobjective.NSGAIIMeasuresRunner problemName [referenceFront]
*/
public static void main(String[] args)
throws JMetalException, InterruptedException, IOException {
DoubleProblem problem;
Algorithm<List<DoubleSolution>> algorithm;
MutationOperator<DoubleSolution> mutation;
String referenceParetoFront = "" ;
String problemName ;
if (args.length == 1) {
problemName = args[0];
} else if (args.length == 2) {
problemName = args[0] ;
referenceParetoFront = args[1] ;
} else {
problemName = "org.uma.jmetal.problem.multiobjective.zdt.ZDT4";
referenceParetoFront = "jmetal-problem/src/test/resources/pareto_fronts/ZDT4.pf" ;
}
problem = (DoubleProblem) ProblemUtils.<DoubleSolution> loadProblem(problemName);
BoundedArchive<DoubleSolution> archive = new CrowdingDistanceArchive<DoubleSolution>(100) ;
double mutationProbability = 1.0 / problem.getNumberOfVariables() ;
double mutationDistributionIndex = 20.0 ;
mutation = new PolynomialMutation(mutationProbability, mutationDistributionIndex) ;
int maxIterations = 250 ;
int swarmSize = 100 ;
algorithm = new SMPSOBuilder(problem, archive)
.setMutation(mutation)
.setMaxIterations(maxIterations)
.setSwarmSize(swarmSize)
.setRandomGenerator(new MersenneTwisterGenerator())
.setSolutionListEvaluator(new SequentialSolutionListEvaluator<DoubleSolution>())
.setVariant(SMPSOBuilder.SMPSOVariant.Measures)
.build();
/* Measure management */
MeasureManager measureManager = ((SMPSOMeasures)algorithm).getMeasureManager() ;
BasicMeasure<List<DoubleSolution>> solutionListMeasure = (BasicMeasure<List<DoubleSolution>>) measureManager
.<List<DoubleSolution>>getPushMeasure("currentPopulation");
CountingMeasure iterationMeasure = (CountingMeasure) measureManager.<Long>getPushMeasure("currentIteration");
ChartContainer chart = new ChartContainer(algorithm.getName(), 200);
chart.setFrontChart(0, 1, referenceParetoFront);
chart.setVarChart(0, 1);
chart.initChart();
solutionListMeasure.register(new ChartListener(chart));
iterationMeasure.register(new IterationListener(chart));
/* End of measure management */
AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(algorithm).execute();
chart.saveChart("./chart", BitmapEncoder.BitmapFormat.PNG);
List<DoubleSolution> population = algorithm.getResult();
long computingTime = algorithmRunner.getComputingTime();
JMetalLogger.logger.info("Total execution time: " + computingTime + "ms");
printFinalSolutionSet(population);
if (!referenceParetoFront.equals("")) {
printQualityIndicators(population, referenceParetoFront);
}
}
开发者ID:jMetal,项目名称:jMetal,代码行数:77,代码来源:SMPSOMeasuresWithChartsRunner.java
注:本文中的org.knowm.xchart.BitmapEncoder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论