FusionCharts XML Object Structure for Delphi?

I am working on a web server that generates XML data to be used for FusionCharts. After several unsuccessful attempts to come up with a standardized object structure in Delphi to port the XML production for these diagrams, I decided to take a look and see if someone had already done this.

I am trying to create an Object Structure in Delphi that wraps the functionality needed to generate XML data for FusionCharts. There are 42 possible chart types, each requiring a slightly different XML structure. The object structure I started building just wraps around the ability to specify general properties of one of these diagrams and generate XML data on the fly based on those properties. This, of course, also involves processing many datasets, each of which is used for a different series in the chart. There are also some fuzzy map charts with combinations of possible datasets that I got lost in trying to implement this structure.

I quickly realized that this is a huge task and would like to see if anyone else has done something similar. I know there is a VCL library out there to display FusionCharts in an application, but that's not what I want. I just need to just pass the XML data to be passed back through the web server to the HTTP client.

Is it already done? If not, any tips or pointers on how to do this? I was going to make one object called TFusionChart

and wrap everything inside it (using a property ChartType

), but there are 42 possible graphs and that would be a huge mess. I can also create 42 different objects, one for each graph, but this will have redundant code.

PS - I am ready to start Bounty for this question, this is very important.


To explain the existing structure of mine a little, I have one basic component called TFusionChart

. This class contains everything that all diagrams have, including category names, title, background, etc. None of the actual charts are based on this. From this class I then TFusionChart2D

and TFusionChart3D

. Then I have another 4 behalf of TFusionChartSingle2D

, TFusionChartMulti2D

, TFusionChartSingle3D

and TFusionChartMulti3D

. From these 4 classes, I start to create the actual components of the diagram. I plan to have a component for every available chart.

The problem I am facing is confusion about how to manage the contained data. Some charts can have a combination of these, for example: multiple series in columns, line series, and stacked data in columns. Only one chart would have a very unique way of storing its data that is difficult to share with other chart types, such as a simple single sequence column chart.

I tried the XML data binding capabilities as described in the answer below, but it was too massive a solution I left it with. Again, due to the fact that there are 42 types of charts. Each graph will mean several thousand lines of code.


source to share

2 answers

I would try to create one class for each chart type, but use base classes to store similar charts. The class should only be the "data holder" for chart data and chart customization, and delegate the generation of XML output to a separate class. This makes it easy to switch between different output generation solutions or plug in other output formats.



I suggest you use XML binding to create a class hierarchy to generate XML.

For this purpose, you can refer to the following XSD resources related to Fusioncharts :

Please don't forget to share if you find other XSD uptodate resources.


Using XML binding also seems like overkill, as the OP points out, I suggest using them alternatively:

  • Remove all unnecessary functions to get a bare XSD still compliant with the Fusioncharts specs and compliant with the OP.
  • Process the bare XSD with an appropriate tool to get the appropriate XMI files (e.g. Entreprise Architect)
  • Download the Case Tool with XMI files and get to work: Designing Lightweight Classes for Generating XML Fusioncharts .


All Articles