tadhg88 Posted March 13, 2007 Posted March 13, 2007 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 Quote
Nate Bross Posted March 15, 2007 Posted March 15, 2007 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. Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.