Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1257
  • Last Modified:

How to create nice looking bar graphs using a text file as input?

How to create nice looking bar graphs using a text file as input?

Originally we'll have some raw data (results of calculations) in a two column table.
The idea is to use a text file with all these values, separated by commas, as input. The output would be bar graphs including title, in a picture format such as PNG or JPEG.

Can anyone recommend me any software or an easy way to implement this?
1 Solution
You have a text file where each row is of the form:data1,data2...If you have Microsoft Excel, then you can import this file as a Comma Separated Variable file, and the two text columns will fill into two Excel columns. From this you can create your nice bar graphs. You can then right click on the chart and copy and paste it into paint. Now you can save it in PNG or other formats.
isoqAuthor Commented:
Hi, Thanks.
Actually what I need is something that automatically use the CSV file as input, and create the picture as output.
Any idea?
You could automatically do this in Excel.  You could write a macro that will automatically generate a graph.  The macro you use will depend on how "Automatic" you require the process to be.

Microsoft have a set of pages on creating graphs in Excel using VBA:


If you really don't want to use Excel, the I suspect that there are graphing tools out there you could pay for that would take a CSV file as an input, but it's not an area I've ever investigated.
 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Or, you can write a C/C++ program using OpenGL. Reading CSV file is easy.
If you do want to use Excel the steps are pretty straightforward.

1 Open file.

2 Create chart using data from file as source.

3 Save file in required format.

All of this can be done in VBA, and can be as 'automatic' as you need/want.

It could also be done in a lot of other programming languages using the same basic algorithim.

Obviously you would need some sort of method of creating a chart but most languages have plenty of ways of dealing with file input/ouput.
I bet this would make a nice little php project (php bar graphs using GD).
Using PHP with your csv (flat file database) or  mySQL as the data container...
Create a form for input,
Use php to store info in csv or mySQL
Retrieve with php generating bargraph into web page.

It would undoubtably be something fun to do with Flash, but I have no suggestions for basis for going about it there.  
I think this might be something in that ilk though...

Or how about Google Charts Tools ?? ;^)

Cheers ;^)
If you can convert the file to a string then you can use this:

isoqAuthor Commented:
Good suggestion

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now