Class Design

tadhg88

Newcomer
Joined
Mar 13, 2007
Messages
1
Hi i am using fusion flash charts in my project the way they are created is i have a basic class to create an xml string which is passed to a RenderChart function which creates the graph. The xml file can contain lots of different parameters such as height width colours etc but they are not all necessary for each chart so i am just wondering if anyone has any suggestions about how to go about correctly designing this class specifically how I will handle so many possible parameters without having to write functions for each combination
Thanks in advance
Tim
 
I would setup the class with this pseudocode.
C#:
int iWidth = 15;  // px
int iHeight = 15; // px
Color bgColor = Color.White;
Color fgColor = Color.Red;

void RenderGraph()
{
    Load XML into an object;
    Read data into variables
    if (XML.GetValue("Width") != null)
        iWidth = (int)XML.GetValue("Width");

    if (XML.GetValue("bgColor") != null)
        bgColor = (Color)XML.GetValue("bgColor");

    etc...
    etc...

    Rendering Logic...
    Graph.BackgroundColor = bgColor;
    Graph.Width = iWidth;
    ...
    ...
    ...

    Graph.Present();
}
This way if the XML has data for a perticular value, it will be updated, otherwise the default value will be used.
 
Back
Top