I've been working on a Web Server which produces XML data to be used for FusionCharts. After days of unsuccessfully trying to come up with a standardized object structure in Delphi to wrap the XML production for these charts, I've decided to look and see if someone has already done so.
What I'm trying to do is build an object structure in Delphi which wraps the functionality needed to produce XML data for the FusionCharts. There are 42 possible types of charts, each of which requires a slightly different XML structure. The object structure I started building simply wraps the ability to specify the common properties of one of such charts and generate XML data on the fly based on these properties. It of course also consists of handling multiple data-sets, each of which is used for a different series in the chart. There are also some oddball charts with a combination of possible datasets, which is where I got lost in trying to implement this structure.
I quickly came to realize that this is a huge task, and would like to see if someone has already done such a thing. I know there is a VCL library out there to display FusionCharts in an application, but this is not what I need. I just need to simply produce the XML data to be passed back through the Web Server to the HTTP client.
Has this already been done? If not, then any tips or pointers as to how to accomplish this? I was getting ready to make one single object called TFusionChart
and wrap everything inside of it (with a ChartType
property), but there are 42 possible charts, and this would be a huge mess. I may also create 42 different objects, one for each chart, but this would have redundant code.
PS - I'm willing to start a Bounty for this question, it is rather important.
UPDATE
Just to explain the existing structure of mine a little bit, I have one base component called TFusionChart
. This class holds everything that all charts have in common, including category names, title, background, etc. None of the actual charts are based off of this. From this class, I then have TFusionChart2D
and TFusionChart3D
. Then I have 4 more called TFusionChartSingle2D
, TFusionChartMulti2D
, TFusionChartSingle3D
, and TFusionChartMulti3D
. From these 4 classes, I then begin creating the actual chart components. I plan to have a component for each of the possible charts that are available.
The problem I'm facing is confusion as to how to manage the data to be contained. Some charts can have a combination of one for example: multiple series in columns, a line series, and stacked data within the columns. This one chart alone would have a very unique way of storing its data, which is difficult to share with other types of charts, for example, a simple single series column chart.
I tried the XML Data Binding capabilities as described in answer below, but this was far too massive of a solution that I abandoned it. Again, because of the fact that there are 42 types of charts. Each chart would mean a few thousand lines of code.