Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

I would setup the class with this pseudocode.

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.

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...