internal string RenderSetImage(BaseWebControl PageControl)
        {
            string REGISTERSCRIPT = string.Empty;

            if (PageControl.SetImageFor.Count() > 0)
            {
                string JSIMGFOR = "document.getElementById('{0}').setAttribute('src',chart.getImageURI());" + Environment.NewLine;
                foreach (string s in PageControl.SetImageFor)
                {
                    REGISTERSCRIPT += string.Format(JSIMGFOR, s, PageControl.ClientID);
                }
            }

            return(REGISTERSCRIPT);
        }
        internal string RenderSetImage(BaseWebControl PageControl)
        {
            string REGISTERSCRIPT = string.Empty;
            if (PageControl.SetImageFor.Count() > 0)
            {
                string JSIMGFOR = "document.getElementById('{0}').setAttribute('src',chart.getImageURI());" + Environment.NewLine;
                foreach (string s in PageControl.SetImageFor)
                    REGISTERSCRIPT += string.Format(JSIMGFOR, s, PageControl.ClientID);
            }

            return REGISTERSCRIPT;
        }
        /// <summary>
        /// Trying to use this option from here out!
        /// </summary>
        /// <param name="PageControl"></param>
        /// <param name="dt"></param>
        /// <param name="CHARTTYPE"></param>
        internal void RegisterGVIScriptsEx(BaseWebControl PageControl, DataTable dt, GOOGLECHART CHARTTYPE)
        {
            string JAVASCRIPT = jscode3;

            //if (CHARTTYPE == GOOGLECHART.CHAP_TIMELINE)
            //    JAVASCRIPT = jschap;

            string options,formatter = string.Empty;
            string imagereplace = string.Empty;
            List<string> events = RenderGVIEvents(PageControl);

            if (PageControl is IGoogleTableFormatterControl)
                formatter = RenderFormatter((IGoogleTableFormatterControl)PageControl);

            if (this.BindingDataTable != null)
            {
                ((EventHandler)this.BindingDataTable)(this, EventArgs.Empty);
            }

            JAVASCRIPT = JAVASCRIPT.Replace("{formatter}", formatter);
            if (!string.IsNullOrEmpty(PageControl.QueryString) && PageControl.QueryString.StartsWith("~"))
            {
                PageControl.QueryString = PageControl.Page.ResolveUrl(PageControl.QueryString);
                JAVASCRIPT = JAVASCRIPT.Replace("{QueryString}", PageControl.QueryString);
            }
            else
            {
                JAVASCRIPT = JAVASCRIPT.Replace("{QueryString}", PageControl.QueryString);
            }

            imagereplace = RenderSetImage(PageControl);
            JAVASCRIPT = JAVASCRIPT.Replace("{SETIMAGEFOR}", imagereplace);

            // Check if manual override for Chart option is in effect
            if ((PageControl.GviOptionsOverride != null) && (!string.IsNullOrEmpty(PageControl.GviOptionsOverride.ToString())))
                options = PageControl.GviOptionsOverride.ToString();
            else
                options = RenderGVIConfigOptions(PageControl);

            // the name of the control being bound and over-written
            string ctlid = PageControl.ClientID;
            if (!string.IsNullOrEmpty(PageControl.OverrideElementId))
                ctlid = PageControl.OverrideElementId;

            // interpolate the options into the canned Javascript
            string optionsJscode = string.Format(JAVASCRIPT,
                ctlid,
                options,
                dic[CHARTTYPE].FirstOrDefault(),
                dic[CHARTTYPE].LastOrDefault(),
                string.Join("\n",events.ToArray()),
                dic[CHARTTYPE].FirstOrDefault().UpperCaseFirst()
            );

            // add version information onto each ChartJavascript
            string build = string.Format("v{0}.{1}.{2}.{3}",
                System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major,
                System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.MajorRevision,
                System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor,
                System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.MinorRevision);
            optionsJscode = optionsJscode.Replace("{ver}", build);

            // load the datatable...
            if (dt == null)
                throw new Exception(string.Format("Unable to create visualization '{0}' with an empty DataTable ", this.GetType().FullName));

            Bortosky.Google.Visualization.GoogleDataTable gdt = new Bortosky.Google.Visualization.GoogleDataTable(dt);
            optionsJscode = optionsJscode.Replace("__DATATABLE__", PageControl.PostProcessData( gdt.GetJson()));

            /*
             * This allows you to manipulate the data
             *  var formatter = new google.visualization.NumberFormat({prefix: '$'});
             *  formatter.format(data, 1); // Apply formatter to second column
             */
            if (!string.IsNullOrEmpty(PageControl.GviFormatterHook))
                optionsJscode = optionsJscode.Replace("/*FORMATTERS*/", string.Format("{0}(chart, data);", PageControl.GviFormatterHook));

            PageControl.Page.ClientScript.RegisterStartupScript(this.GetType(), "function_" + ctlid, optionsJscode, true);

            //RenderSetImage(PageControl);
            //string datatableoutput = TransformDataTable.ToGoogleDataTable(dt);
            //PageControl.Page.ClientScript.RegisterStartupScript(this.GetType(), "vis_" + ctlid, string.Format("var data_{0} = function() {{ {1} }}", ctlid, datatableoutput), true);
        }
        /// <summary>
        /// Trying to use this option from here out!
        /// </summary>
        /// <param name="PageControl"></param>
        /// <param name="dt"></param>
        /// <param name="CHARTTYPE"></param>
        internal void RegisterGVIScriptsEx(BaseWebControl PageControl, DataTable dt, GOOGLECHART CHARTTYPE)
        {
            string JAVASCRIPT = jscode3;

            //if (CHARTTYPE == GOOGLECHART.CHAP_TIMELINE)
            //    JAVASCRIPT = jschap;

            string        options, formatter = string.Empty;
            string        imagereplace = string.Empty;
            List <string> events       = RenderGVIEvents(PageControl);


            if (PageControl is IGoogleTableFormatterControl)
            {
                formatter = RenderFormatter((IGoogleTableFormatterControl)PageControl);
            }


            if (this.BindingDataTable != null)
            {
                ((EventHandler)this.BindingDataTable)(this, EventArgs.Empty);
            }


            JAVASCRIPT = JAVASCRIPT.Replace("{formatter}", formatter);
            if (!string.IsNullOrEmpty(PageControl.QueryString) && PageControl.QueryString.StartsWith("~"))
            {
                PageControl.QueryString = PageControl.Page.ResolveUrl(PageControl.QueryString);
                JAVASCRIPT = JAVASCRIPT.Replace("{QueryString}", PageControl.QueryString);
            }
            else
            {
                JAVASCRIPT = JAVASCRIPT.Replace("{QueryString}", PageControl.QueryString);
            }


            imagereplace = RenderSetImage(PageControl);
            JAVASCRIPT   = JAVASCRIPT.Replace("{SETIMAGEFOR}", imagereplace);



            // Check if manual override for Chart option is in effect
            if ((PageControl.GviOptionsOverride != null) && (!string.IsNullOrEmpty(PageControl.GviOptionsOverride.ToString())))
            {
                options = PageControl.GviOptionsOverride.ToString();
            }
            else
            {
                options = RenderGVIConfigOptions(PageControl);
            }


            // the name of the control being bound and over-written
            string ctlid = PageControl.ClientID;

            if (!string.IsNullOrEmpty(PageControl.OverrideElementId))
            {
                ctlid = PageControl.OverrideElementId;
            }

            // interpolate the options into the canned Javascript
            string optionsJscode = string.Format(JAVASCRIPT,
                                                 ctlid,
                                                 options,
                                                 dic[CHARTTYPE].FirstOrDefault(),
                                                 dic[CHARTTYPE].LastOrDefault(),
                                                 string.Join("\n", events.ToArray()),
                                                 dic[CHARTTYPE].FirstOrDefault().UpperCaseFirst()
                                                 );

            // add version information onto each ChartJavascript
            string build = string.Format("v{0}.{1}.{2}.{3}",
                                         System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major,
                                         System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.MajorRevision,
                                         System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor,
                                         System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.MinorRevision);

            optionsJscode = optionsJscode.Replace("{ver}", build);


            // load the datatable...
            if (dt == null)
            {
                throw new Exception(string.Format("Unable to create visualization '{0}' with an empty DataTable ", this.GetType().FullName));
            }


            Bortosky.Google.Visualization.GoogleDataTable gdt = new Bortosky.Google.Visualization.GoogleDataTable(dt);
            optionsJscode = optionsJscode.Replace("__DATATABLE__", PageControl.PostProcessData(gdt.GetJson()));



            /*
             * This allows you to manipulate the data
             *  var formatter = new google.visualization.NumberFormat({prefix: '$'});
             *  formatter.format(data, 1); // Apply formatter to second column
             */
            if (!string.IsNullOrEmpty(PageControl.GviFormatterHook))
            {
                optionsJscode = optionsJscode.Replace("/*FORMATTERS*/", string.Format("{0}(chart, data);", PageControl.GviFormatterHook));
            }

            PageControl.Page.ClientScript.RegisterStartupScript(this.GetType(), "function_" + ctlid, optionsJscode, true);

            //RenderSetImage(PageControl);
            //string datatableoutput = TransformDataTable.ToGoogleDataTable(dt);
            //PageControl.Page.ClientScript.RegisterStartupScript(this.GetType(), "vis_" + ctlid, string.Format("var data_{0} = function() {{ {1} }}", ctlid, datatableoutput), true);
        }