Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet visualize free disk space
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


rasanga ratnayake
visualize free disk space
1 Answer(s)      3 years and 6 months ago
Posted in : JSP-Servlet


hi i want to visualize free disk spaces of machines as a bar chart.thanks.


Advertisement
View Answers

July 22, 2011 at 3:41 PM


import java.io.*;
import java.text.*;
import org.jfree.chart.*;
import org.jfree.chart.plot.*;
import org.jfree.chart.axis.*;
import org.jfree.data.category.*;
import org.jfree.chart.renderer.category.*;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;

public class ChartDemo{

   public static void main(String arg[]){
      File f1=new File("C:\\");
      File f2=new File("D:\\");
      long d1 = f1.getFreeSpace()/1024/1024;
      long d2 = f2.getFreeSpace()/1024/1024;
      DefaultCategoryDataset dataset = new DefaultCategoryDataset();
      dataset.setValue(d1, "Free Space", "C");
      dataset.setValue(d2, "Free Space", "D");
      JFreeChart chart = ChartFactory.createBarChart("Bar Chart","Drives", "Free Space(in MB)", dataset, 
      PlotOrientation.VERTICAL, false,true, false);
      CategoryPlot p = chart.getCategoryPlot(); 
      NumberAxis rangeAxis = (NumberAxis) p.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
      BarRenderer renderer = (BarRenderer) p.getRenderer();
      DecimalFormat decimalformat1 = new DecimalFormat("##");
      renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", decimalformat1));
      renderer.setItemLabelsVisible(true);
      chart.getCategoryPlot().setRenderer(renderer);
      ChartFrame frame=new ChartFrame("Bar Chart",chart);
      frame.setVisible(true);
      frame.setSize(350,450);
    }
 }


Related Tutorials/Questions & Answers:
visualize free disk space
visualize free disk space  hi i want to visualize free disk spaces of machines as a bar chart.thanks.
Display free disk space
Description: This example will demonstrate how to get the free disk space... in java.io.File. This method get the free disk space in the bytes. Code... upon number of drive you have and the free space available. Note
Advertisements
PHP find free space, php disk_free_space, disk_free_space
The example Shows of disk_free_space() function in php Program. In this section you will find the example code of disk_free_space() function. The disk_free_space() function in PHP is used to find the Hard Disk's free space from
diskfreespace php, Find free disk space from PHP program
will shows how you can find the free disk space from your php program...) gives the free space present on the disk in bytes works same as the function disk_free_space() works in php4 and php5 Code for freediskspace() Function PHP
Find total disk space in PHP, php disk_total_space, disk_total_space
Learn How to Get the total disk space in PHP Program. In this PHP Tutorial example we will use the disk_total_space() function in our PHP code to find the total disk space. syntax disk_total_space() Function PHP disk_total_space
Java file get free space
Java file get free space In this section, you will learn how to find the free... with java.io.File. These methods provides essential information regarding disk space...(); System.out.println("Free space= " + value + " bytes"); } } You can find
Java Get Free Space
Java Get Free Space       In this section, you will study how to obtain available free space in the specified file. In the given example, we have provided the path
Free Web Hosting
and then compare these free web space providers. Here is the list of Free Web Hosting... Support.     http://www.topcities.com/ We offer free space... and receive free space and tools for you to build your own web site. What you
Examples of optical disk
Examples of optical disk  What is the example of Optical disk? Please give me at least one example of it.   Digital versatile disks is a example of optical disk
Free JSP, Free EJB and Free Servlets Hosting Servers
J2 JVM -5 Megabytes Disk Space -Disk Read/Write access to your... Free JSP, Free EJB and Free Servlets Hosting Servers...; Other Free Hosting Services 
Free JSP, Free EJB and Free Servlets Hosting Servers
-5 Megabytes Disk Space -Disk Read/Write access to your...Free JSP, Free EJB and Free Servlets Hosting Servers  MyCGIserver - Free Hosting server
Remove Extra Space At End
Remove Extra Space At End  Remove Extra Space At End
time and space complexity
time and space complexity  sort the data structures according to efficient time and space utilisation
Display total disk drive capacity
Description: This example will demonstrate how to get the total disk space... This method gets the total disk capacity in the bytes. Code... of this example depends upon number of drive you have and the total disk capacity
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space error. This error is coming while...: Java heap space where there is no more space available for the Java program... space. You can also increase the Java heap space using following parameters
Program to Ignore Space and Enter ?!
Program to Ignore Space and Enter ?!  Hi, dear friend i wont to write program to enter many statements, if i use Space and Enter in the Run Time must be delete the space and ignore the Enter ..for example if i entered
Java file get total space
These methods provides essential information regarding disk space. In the given...Java file get total space In this section, you will learn how to get the total space of disc. Description of code: JDK 1.6 provides few new methods
create archive file on local disk in oracle 9i
create archive file on local disk in oracle 9i  how to create archive file on local disk and insert it in the oracle 9i database by java and MySQL. plz send to whole description all about this urgently. Thanks
xmlname space in java
xmlname space in java  hi i want to write code like , i used setAttribute method for this. but its showing ERROR: 'Namespace for prefix 'company' has not been declared.' javax.xml.transform.TransformerException
Forcing Updates to a File to the Disk
Forcing Updates to a File to the Disk       In this program we are going to update a file forcefully. Firstly we have to make an object of OutputStream and pass a file name in which
Java heap space
Java heap space  I am using MyEclipse 8.6 for my web based project. The command may be... Ex: java -Xms32m -Xmx128m How can I increase java heap space??? and Where to use this command exactly?   Following are few
Saving URL in local disk - Java Beginners
Saving URL in local disk  Hi Friend, How can i Save URL like "www.jagran.com " on local disk throgh java Statement. Thanks ,in advance
how to space images in html code
how to space images in html code  how to space images in html code
space around/between my images
space around/between my images  How do I eliminate the space around/between my images
in java, how to store the oputput in tha hard disk in a particular location
in java, how to store the oputput in tha hard disk in a particular location  how to store the output in the hard disk
Space based web-hosting system
, Disk Space, Memory, Network throughput etc. Most of the virtual private server...Space based web-hosting system Here, space based web hosting system refers to the web hosting service according to sharing the space on the server
space between buttons iPhone SDK
space between buttons iPhone SDK  Hi, can any one please explain how to add space between UIButtons in iPhone SDK. Actually i am creating Multiple UIButton's and added them to my UIScrollView. But problem is that those buttons
White Space encoding problem in PDF
White Space encoding problem in PDF  I am reading PDF version 1.3 using iText. Things are fine but with one problem that is I am not able to get whitespace. Is there any problem in whitespace encoding in PDF version 1.3
Validaton(Checking Blank space) - Spring
Validaton(Checking Blank space)  Hi i am using java springs .I am having problem in doing validation. I am just checking blank space. This is my controller. I named it salescontroller. package controller; import
there extra space before or after my table.
there extra space before or after my table.  Why is there extra space before or after my table
eliminate the extra space after a </form> tag
eliminate the extra space after a tag  How can I eliminate the extra space after a tag
Advertisements
 

 

 

DMCA.com