The i-Technology Media!
Register | Log in
   
 
.NET  ·  AJAX  ·  CLOUD  ·  ECLIPSE  ·  FLEX  ·  OPEN WEB  ·  iPHONE  ·  JAVA  ·  LINUX  ·  OPEN SOURCE  ·  ORACLE  ·  PBDJ  ·  SEARCH  ·  SILVERLIGHT  ·  SOA  ·  VIRTUALIZATION  ·  WEB 2.0  ·  WIRELESS  ·  XML
Comments
Google Wave Invitation Giveaway
By Aditya Banerjee
Timo Hirvonen wrote: I would really appreciate an invitation. Been desperately trying to find one :) timo [dot] hirvonen [at] gmail [dot]com
Nov. 27, 2009 11:13 AM EST
Cloud Expo on Google News
Did you read today's front page stories & breaking news?


2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts

2009 East
GOLD SPONSORS:
CA
Get Your Transactions Under Control: SOA Performance Management
Software AG
Performance Driven Adoption: The Secret to Advancing SOA
Intel
The Evolving SOA Appliance: 3 Game-Changing Innovations
SILVER SPONSOR:
Denodo
Data Mashups: Deliver Your Project Faster with Virtualized Data Services Across Internal & External Sources
POWER PANELS:
The Business Value of Service Orientation
Driving Profitability Through User Experience
Click For 2008 West
Event Webcasts
Live Google News by SYS-CON!
Top Three Links You Must Click On


Features
PowerBuilder with FusionCharts
Generating next-generation charts in WebForm applications

By: Bruce Armstrong
Feb. 27, 2009 12:00 PM

Back in August of 2007, I wrote an article entitled "Dynamically Generating Next-Generation Charts from PowerBuilder DataWindows" that demonstrated one method of dynamically generating Flash charts from within a PowerBuilder application. I was primarily writing that from the perspective of writing standard client/server applications. PowerBuilder 11 was just freshly released, and so while the option of creating WebForm applications that incorporated the technology was a factor that was being considered, it wasn't part of the sample at that time.

Fortunately, Haibo Ni of Sybase decided to take that on and came up with an implementation for PowerBuilder .NET WebForm applications. However, Haibo didn't just take my earlier example and create a WebForm target from it. He created his own similar solution based on a different library. I used XML/SWF Charts, a library that I just stumbled across while researching the possibility of generating Flash from PowerBuilder. Haibo used the free version of FusionCharts. FusionCharts is a commercial library, but they make the previous version available for free in order to encourage people to try out their product (and hopefully upgrade to the commercial version). The FusionCharts example as well as my previous XML/SWF Charts example are both available on Sybase's CodeXchange site.

It's hard to do the results justice with simple screenshots because (see Figure 1), as with the XML/SWF Charts sample I did, many of the FusionCharts involve animation. Also similar to the XML/SWF Charts sample, the underlying implementation involves providing an XML file to a Flash library in order to dynamically generate the chart.

But that's also where the similarity ends. With the XML/SWF Chart sample, there was only one Flash library used regardless of the chart type that would eventually be produced. Doing so required a great deal of the chart formatting information to be passed in with the data. That is, the XML file used for XML/SWF contained both formatting and data. Also, if you remember, the data had to be incorporated in the file in a method that was a bit non-native to XML.

With FusionCharts, there is a separate Flash library for each different chart type that is being generated. In addition, formatting information is passed into the library through parameters passed in via the HTML that the Flash library is embedded in (see Listing 1) or via attributes in the first line of the data XML (see Listing 2). As a result, the XML file that is provided contains primarily the data, and in a more normal data format for XML files (see Listing 2). It's also possible to pass the data directly into the library through a dataXML parameter as well, although for all of the examples the data will be passed in via an XML file to the dataURL parameter instead. The samples that Haibo provides also use a JavaScript file to wrap the calls to the Flash library and set the parameters.

So far, this looks fairly straightforward. The main question becomes: "How do you get the chart to display in the WebForm?" When I implemented the XML/SWF Chart sample, I did it for a standard client/server application using the Shockwave ActiveX in a window. However, the WebForm deploy doesn't support ActiveX controls, so some other mechanism must have been used. Even if that did work, that's not the way you'd want to implement it. Most browsers already have a Flash plugin available; you just want to provide the HTML to tell the browser to use that.

The solution is fairly simple, though not obvious. When you deploy an application to WebForms, a property called Embedded becomes available for the StaticHyperLink control. There's some discussion of it in the "Properties for .NET Web Forms" section of the HTML Books documentation for PowerBuilder. Otherwise, you wouldn't know about it. It's not mentioned in the WinHelp file, and the property pane for the control, the system browser, and the AutoScripting feature know nothing of it. When the property is set to true, instead of rendering as a hyperlink, the web page that is referenced is displayed within the IFRAME that is rendered at runtime for the control. Obviously you need to expand the size of the control to accommodate the page.

As a result, the code required to display the chart within the WebForm becomes fairly simple (see Listing 3). The n_cst_fusioncharts object is the object that Haibo created to do the heavy lifting for interacting with the FusionCharts library. In particular, its of_generatehtml_javascript and of_generatedataxml method are the methods used to generate the HTML and XML for the chart, respectively. The embedded property is then set to TRUE for the statichyperlink control and the URL assigned for the HTML page that was generated. The XML file that was generated is referenced within the HTML.

The of_generatehtml_javascript function dynamically generates the HTML based on the type of chart requested and some of its properties (see Listing 4).

The of_generatedataxml function is also worth looking at (see Listing 5). Because it's fairly large, it's only available online.

Regardless, if you're interested in generating next-generation charts in your WebForm applications, you should take a look at what Haibo has provided. The n_cst_fusioncharts object is already architected to do the majority of work for you. You only need to plug it into your application and start using it.

Published Feb. 27, 2009— Reads 1,598
Copyright © 2009 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
About Bruce Armstrong
Bruce Armstrong is a development lead with Integrated Data Services (www.get-integrated.com). A charter member of TeamSybase, he has been using PowerBuilder since version 1.0.B. He was a contributing author to SYS-CON's PowerBuilder 4.0 Secrets of the Masters and the editor of SAMs' PowerBuilder 9: Advanced Client/Server Development.

Add Your Feedback

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers

ADS BY GOOGLE

Breaking Java News
H2O Innovation Amends its Stock Option Plan and Grants Stock Options
Russell Breweries Inc. Reports Positive EBITA in Q1 2010 Fiscal Results
Lingo Media Reports Third Quarter Results
Quaterra Converts Notes and Interest to Shares
GSI Group Calls Shareholders Meeting
Cannasat Therapeutics Reports Results for the Nine Months Ended September 30, 2009
Wal-Mart Court Ruling a Narrow Technical Victory
The Week Ahead for The Department of Justice for November 30 - December 4, 2009
Government of Canada, Government of Yukon and Communities Support Improvements to Recreational Facilities in Yukon
Norstar Securities Trust Announces Third Quarter Results

ADVERTISE   |   MAGAZINE SUBSCRIPTIONS   |   FREE BREAKING-NEWSLETTERS!   |   SYS-CON.TV   |   BLOG-N-PLAY!   |   WEBCAST   |   EDUCATION   |   RESEARCH

.NET Developer's Journal - .NETDJ   |   ColdFusion Developer's Journal - CFDJ   |   Eclipse Developer's Journal - EDJ   |   Enterprise Open Source Magazine - EOS
Open Web Developer's Journal - OPENWEB   |   iPhone Developer's Journal - iPHONE   |   Virtualization - Virtualization   |   Java Developer's Journal - JDJ   |   Linux.SYS-CON.com
PowerBuilder Developer's Journal - PBDJ   |   SEO / SEM Journal - SJ   |   SOAWorld Magazine - SOAWM   |   IT Solutions Guide - ITSG   |   Symbian Developer's Journal - SDJ
WebLogic Developer's Journal - WLDJ   |   WebSphere Journal - WJ   |   Wireless Business & Technology - WBT   |   XML-Journal - XMLJ   |   Internet Video - iTV
Flex Developer's Journal - Flex   |   AJAXWorld Magazine - AWM   |   Silverlight Developer's Journal - SLDJ   |   PHP.SYS-CON.com   |   Web 2.0 Journal - WEB2
Apache   |   CMS   |   CRM   |   HP   |   Oracle Journal   |   Perl   |   Python   |   Red Hat   |   Ruby on Rails   |   SAP   |   SaaS

SYS-CON MEDIA:   ABOUT US   |   CONTACT US   |   COMPANY NEWS   |   CAREERS   |   SITE MAP
SYS-CON EVENTS:   |  AJAXWorld Conference & Expo  |  iPhone Developer Summit  |  Cloud Computing Conference & Expo  |  SOA World Conference & Expo  |  Virtualization Conference & Expo
INTERNATIONAL SITES:   India  |  U.K.  |  Canada  |  Germany  |  France  |  Australia  |  Italy  |  Spain  |  Netherlands  |  Brazil  |  Belgium
 Terms of Use & Our Privacy Statement     About Newsfeeds / Video Feeds
Copyright ©1994-2008 SYS-CON Publications, Inc. All Rights Reserved. All marks are trademarks of SYS-CON Media.
Reproduction in whole or in part in any form or medium without express written permission of SYS-CON Publications, Inc. is prohibited.
 
close this window