🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

"display plot view result in java application"

User: "tapankhiste"
New Altair Community Member
Updated by Jocelyn
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

Find more posts tagged with

Sort by:
1 - 3 of 31
    User: "Marco_Boeck"
    New Altair Community Member
    Hi,

    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
    User: "juasu56"
    New Altair Community Member

    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 

    User: "arulganesanaras"
    New Altair Community Member
    private static IOObject myExampleSet;

    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