Business Graphics: Real-Time scenarios(Part-I)
- Graphical representation of data is a very hot topic. A simple business graphic is a chart consisting of a category and one or more data series.
But In real-time applications it is difficult to hardcode data series every time for creating business graphics. In several real time applications it is required to get data source from external sources like external files or from websites.
- In this Part 1 web log I am going to discuss about getting real time data to create business graphics and in part 2 is step by step Procedure for creating Business graphics from Excel data.
Business Graphics Overview:
- The Business Graphics UI element provides several chart types such as vertical bar charts or pie charts, that can be used for the graphical illustration of data and data relationships. In addition, there are more complex chart types such as portfolio and gantt.
- We will see three scenarios to get real time data.
1. Getting real Time data from Web Using JAVA:
- Java’s URL class makes accessing Web resources as easy as accessing a local file. A URL identifies resources such as files, Web pages, and Web applications that exist on the Web.
- Data that is retrieved from a URL can be diverse, which necessitates a uniform mechanism for reading from and writing to URLs. Java offers such a mechanism in its java.net package.
- The specific class from this package that we want to discuss is the URL class.
- Once we have successfully created an instance of the URL class, then we can begin to call operations on it. But before to access the resource or content represented by the URL, we must open a connection to it. We can do this with the openConnection method call.
- Using the java.iostream classes to read from a URL is a simple process. Once we have a successful connection, we retrieve the input stream for the connection and begin reading. URLs can represent resources consisting of a wide variety of data formats.
- Fortunately, the java.io classes can operate on data returned from URLConnection streams in the same fashion that they operate on file streams or socket streams.
Here is the Sample Java code to get data from web:
It will give the HTML output file. From this we can extract our required data .
2. Getting Real Time data from web in Excel:
- In many real time applications Excel will be used as External Data resource. Because using excel we can easily populate and arrange Numeric data, we can use and create functions to manipulate data, and simply it is easy to manage.
- There is one Research Task option available in Excel 2003 and it allows all Office applications to pull information from dedicated services on the internet.
- The Research task will appear to the right of the Excel window (Tools->Research)
- Excel provides built-in access to a small set of Research services. These include MSN Money stock quotes; a dictionary, thesaurus, and encyclopedia; and the MSN internet search engine. Research services let you drag and drop data directly into your spreadsheet. The Research task is a nice tool for getting up-to-date information.
- There is one more tool available in excel to extract information available from web. That is called WebQuery.
- Web queries were introduced in Excel 2002. Essentially, a web query allows you to fetch data from a table in virtually any web page. For example, if we want stock quotes we can surf directly to Yahoo Financial.
- One more approach is we can also call some dedicated Web services from Excel. Calling a web service is like calling a built-in Excel function, in that you supply some information (as arguments) and retrieve a result.
- The difference is that unlike an Excel function, the web service doesn’t execute on your computer. Instead, it runs on a web server somewhere on the internet.
3. Getting Real Time data from Web Services:
- A Web service is an entity that can exchange documents with the outside world. This entity is self descriptive and possesses a unique identity. Simply a web service is a miniature program that you can call over the Web. And nowadays there are lots and lots of web services are available. We can use corresponding Web service to get our required data.
By this we can get real time data from web and we can use it as Data resource for Business graphics.
In part 2 I will explain Step-Step Procedure to Create Business Graphics from Excel Data
Nice one.Could you throw some light on "connection.setDoInput(true);"
After getting that URL Instance u can use it for input and /or output .In this application we r going to use that URL instance as input .So i have set it as TRUE.
Thanks and Regards,