Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.
"display plot view result in java application"
tapankhiste
Member Posts: 4 Contributor I
When we called process of rapidminer in java program so it return example set as result.but if i want display plot view result in my java application so how can i get plot view result of partucular rapidminer processes in java application..give me java code to display process plot view result in java
0
Answers
this thread should help you: http://rapid-i.com/rapidforum/index.php/topic,6760.0.html
I cannot give you fully fledged out example code.
Regards,
Marco
Hi marco
that link isn't working anymore, do you have another link about the same topic ? i haven't found anything about it.
thank you
public static void main(String[] args) throws Exception {
JFrame frame = new JFrame("Decision Tree Renderer Test");
frame.setLocation(0, 0);
JLabel label = new JLabel();
frame.add(new JScrollPane(label));
// Path to process-definition
// final String processPath =
// "/C:/Users/Administrator/.RapidMiner/repositories/Local
// Repository/processes/filter1.rmp";
final String processPath = "/C:/Users/Administrator/.RapidMiner/repositories/Local Repository/processes/clustermodel.rmp";
// final String processPath =
// "/C:/Users/Administrator/.RapidMiner/repositories/Local
// Repository/processes/joinaggregate.rmp";
// String processPath =
// "/C:/Users/Administrator/.RapidMiner/repositories/Local
// Repository/processes/Desctree.rmp";
try {
// Init RapidMiner
RapidMiner.setExecutionMode(ExecutionMode.EMBEDDED_WITH_UI);
Plugin.setInitPlugins(true);
RapidMiner.init();
// Load process
final com.rapidminer.Process process = new com.rapidminer.Process(new File(processPath));
IOContainer ioResult = process.run();
IOObject result = ioResult.getElementAt(0); // or whatever index you
// need
String name = RendererService.getName(result.getClass());
List renderers = RendererService.getRenderers(name);
for (Renderer renderer : renderers) { // you don't really need to
// iterate over this, it's
// probably only one anyway
// ;)XJ
IOContainer dummy = new IOContainer();
// edit size of image here
int imgWidth = 1000;
int imgHeight = 800;
Reportable reportable = renderer.createReportable(result, ioResult, imgWidth, imgHeight);
if (reportable instanceof Renderable) {
Renderable renderable = (Renderable) reportable;
renderable.prepareRendering();
int preferredWidth = renderable.getRenderWidth(400);
int preferredHeight = renderable.getRenderHeight(400);
final BufferedImage img = new BufferedImage(imgWidth, imgHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = (Graphics2D) img.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imgWidth, imgHeight);
// scale to whatever you need
graphics.scale(2, 2);
renderable.render(graphics, preferredWidth, preferredHeight);
label.setIcon(new ImageIcon(img));
}
}
frame.setVisible(true);
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
System.out.println(ioResult);
} catch (Exception ex) {
}
Hi, please try this ,here i have attached rmp process file you can download and use it