Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6579559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:54:51+00:00 2026-05-25T15:54:51+00:00

I am currently testing a software that writes a couple of CSV files. Now

  • 0

I am currently testing a software that writes a couple of CSV files. Now I am looking for a free tool to generate automatically charts (images) from that files. I am working with eclipse and I am working with ANT to build my project. So a tool (perhaps in Java) to use it with ANT would be great.

Currently, I have to do many steps by hand:

  • go to the folder of the files
  • open and edit the files (replace . by , in numbers)
  • open the file in open office
  • create a diagram
  • export it

Has anybody an idea how to automate this process (even some steps of it)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:54:52+00:00Added an answer on May 25, 2026 at 3:54 pm

    Option 1

    A very useful program on unix for generating graphs is gnuplot.

    I also found a csv2gnuplot script which you could use in a shell script to batch process files.

    Option 2

    If you’re married to an ANT/Java solution (perhaps you’re on windows), then I adapted the following example using jfreechart

    src/sample.csv

    Max Pause Goal,Minor Collections,Major Collections,Pause Count,Max Pause,GC Time,Total Time, Throughput
    0,49,0,49,0.005,0.081,1.831,95.599
    100,49,0,49,0.005,0.077,1.828,95.785
    200,49,0,49,0.005,0.081,1.829,95.550
    300,47,0,47,0.009,0.089,1.837,95.145
    400,48,0,48,0.005,0.081,1.835,95.598
    500,48,0,48,0.005,0.078,1.825,95.729
    600,49,0,49,0.005,0.081,1.830,95.600
    700,48,0,48,0.005,0.081,1.828,95.564
    800,44,0,44,0.017,0.094,1.857,94.919
    900,49,0,49,0.006,0.082,1.833,95.533
    1000,49,0,49,0.005,0.088,1.840,95.224
    

    build.xml

    <project name="demo" default="chart" xmlns:ivy="antlib:org.apache.ivy.ant">
    
        <property name="build.dir"   location="build"/>
        <property name="input.file"  location="src/sample.csv"/>
        <property name="output.file" location="${build.dir}/sample.png"/>
    
        <target name="init">
            <ivy:resolve/>
            <ivy:cachepath pathid="build.path" conf="build"/>
    
            <mkdir dir="${build.dir}"/>
        </target>
    
        <target name="chart" depends="init">
            <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="build.path"/>
    
            <groovy>
            import java.io.*;
            import java.util.StringTokenizer;
    
            import org.jfree.chart.*;
            import org.jfree.chart.plot.*;
            import org.jfree.data.xy.*;
    
            boolean SHOW_LEGEND = false;
            boolean SHOW_TOOLTIPS = false;
            boolean GENERATE_URLS = false;
    
            FileReader fr = new FileReader(properties["input.file"]);
            BufferedReader br = new BufferedReader(fr);
    
            // Get the x-axis label from the first token in the first line
            // and the y-axis label from the last token in the first line.
            String line = br.readLine();
            StringTokenizer st = new StringTokenizer(line, ",");
            String xLabel = st.nextToken();
            String yLabel = st.nextToken();
            while (st.hasMoreTokens()) yLabel = st.nextToken();
    
            String title = yLabel + " by " + xLabel;
    
            // Get the data to plot from the remaining lines.
            float minY = Float.MAX_VALUE;
            float maxY = -Float.MAX_VALUE;
            XYSeries series = new XYSeries("?");
            while (true) {
                line = br.readLine();
                if (line == null) break;
                st = new StringTokenizer(line, ",");
    
                // The first token is the x value.
                String xValue = st.nextToken();
    
                // The last token is the y value.
                String yValue = "";
                while (st.hasMoreTokens()) yValue = st.nextToken();
    
                float x = Float.parseFloat(xValue);
                float y = Float.parseFloat(yValue);
                series.add(x, y);
    
                minY = Math.min(y, minY);
                maxY = Math.max(y, maxY);
            }
    
            XYSeriesCollection dataset = new XYSeriesCollection();
            dataset.addSeries(series);
    
            JFreeChart chart = ChartFactory.createXYLineChart(
                title, xLabel, yLabel, dataset,
                PlotOrientation.VERTICAL,
                SHOW_LEGEND, SHOW_TOOLTIPS, GENERATE_URLS);
    
            XYPlot plot = chart.getXYPlot();
            plot.getRangeAxis().setRange(minY, maxY);
    
            int width = 500;
            int height = 300;
            ChartUtilities.saveChartAsPNG(new File(properties["output.file"]), chart, width, height);
            </groovy>
        </target>
    
        <target name="clean">
            <delete dir="${build.dir}"/>
        </target>
    
    </project>
    

    ivy.xml

    The ivy plug-in enables ANT to talk to Maven repositories.

    <ivy-module version="2.0">
        <info organisation="org.myspotontheweb" module="demo"/>
        <configurations defaultconfmapping="build->default">
            <conf name="build" description="ANT tasks"/>
        </configurations>
        <dependencies>
            <dependency org="org.codehaus.groovy" name="groovy-all" rev="1.8.2"/>
            <dependency org="jfree" name="jfreechart" rev="1.0.13"/>
            <dependency org="jfree" name="jcommon" rev="1.0.15" force="true"/>
        </dependencies>
    </ivy-module>
    

    Note:
    The latest version of jfreechart has a broken dependency on version 1.0.16 of jcommon (not present in Maven Central)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a small free tool. It's currently in Beta testing using .NET 3.5
So I'm extremely new to software testing, and am looking at adding a couple
I'm currently testing a .NET 2.0 client application for Windows 7 Software Logo compliance
I'm currently testing an OpenID implementation, and I'm noticing that Google sends a different
I have started to try out noSQL databases now and are currently testing out
I've been trying to implement unit testing and currently have some code that does
I've got a Java software that reads settings from properties files and database, reads
I'm having troubles with a PHP script that imports csv files into MongoDB. There's
When a software is developed,various types of testing is done - unit,integration,functional,manual.In my current
I am currently testing this in Mozilla FireFox 3.0.5 using FireBug 1.3.0 with jQuery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.