[email protected] Report post Posted January 14, 2009 Hi, We are using your Gantt chart in our systems to present machines and operators reports. (Asp.Net systems) we have the following problem: the chart works fine for presenting several reports, but every now and then instead of presenting the chart we receive a greeen square in the left upper corner of the screen instead of the chart. in order to see the chart once more the user has to close the system and reopen it. Why does it happen? do you have a solution? see attached a print screen of the problematic output. Thanks in advance, Ilan. Share this post Link to post Share on other sites
Rahul Kumar Report post Posted January 14, 2009 Hi, Could you please answer the following? 1. Are you using % width height while rendering the chart? 2. Also are you using some scaling (noScale,exactFit, etc..) to the chart? Share this post Link to post Share on other sites
[email protected] Report post Posted January 15, 2009 Dear Rahul, Thanks for your quick reply. indeed we are using % width in the code generating the Gantt chart. the hight is an integer passed to the function. if is is the problem, then please advise on a method to change it in order to prevent it from happening. following is the C# code that creates the Gantt chart: private void createGanttFromXMLSourse(int hight){ tdGantt.Controls.Clear(); StringBuilder sb = new StringBuilder(); if (!chkFitToPage.Checked){ float widthParam = Convert.ToSingle(ddlGanttZoom.Text) / 7; if(widthParam < 1)widthParam = 1; sb.Append( "var myChart = new FusionCharts('../FusionGadgets_Developer/Charts/Gantt.swf', 'chartId', '" + (1000 * widthParam) + "', '" + hight + "', '0', '1');");} else{ sb.Append( "var myChart = new FusionCharts('../FusionGadgets_Developer/Charts/Gantt.swf', 'chartId', '100%', '" + hight + "', '0', '1');");} sb.Append( "myChart.setDataURL('Data/OperatorsGanttZoomOut.xml');");sb.Append( "myChart.render('chartdiv');"); //sb.Append("</script>"); HtmlGenericControl divControl = new HtmlGenericControl("div");divControl.Attributes.Add( "id", "chartdiv"); HtmlGenericControl control = new HtmlGenericControl("script");control.Attributes.Add( "type", "text/javascript");control.InnerText = sb.ToString(); tdGantt.Controls.Add(divControl); tdGantt.Controls.Add(control); } Share this post Link to post Share on other sites
Rahul Kumar Report post Posted January 15, 2009 Hi, You would need to specity the width in number, please do not use % (percentage) in width or height. private void createGanttFromXMLSourse(int hight){ tdGantt.Controls.Clear(); StringBuilder sb = new StringBuilder(); if (!chkFitToPage.Checked){ float widthParam = Convert.ToSingle(ddlGanttZoom.Text) / 7; if(widthParam < 1)widthParam = 1; sb.Append( "var myChart = new FusionCharts('../FusionGadgets_Developer/Charts/Gantt.swf', 'chartId', '" + (1000 * widthParam) + "', '" + hight + "', '0', '1');");} else{ sb.Append( "var myChart = new FusionCharts('../FusionGadgets_Developer/Charts/Gantt.swf', 'chartId', '960', '" + hight + "', '0', '1');");} sb.Append( "myChart.setDataURL('Data/OperatorsGanttZoomOut.xml');");sb.Append( "myChart.render('chartdiv');"); //sb.Append("</script>"); HtmlGenericControl divControl = new HtmlGenericControl("div");divControl.Attributes.Add( "id", "chartdiv"); HtmlGenericControl control = new HtmlGenericControl("script");control.Attributes.Add( "type", "text/javascript");control.InnerText = sb.ToString(); tdGantt.Controls.Add(divControl); tdGantt.Controls.Add(control); } Also could you please let us know the version of gantt chart you are using? [NOTE: Version info can be obtained, if you render the chart in debug mode.] Example: var myChart = new FusionCharts('../FusionGadgets_Developer/Charts/Gantt.swf', 'chartId', '960', '" + hight + "', '1', '1'); Share this post Link to post Share on other sites
[email protected] Report post Posted January 15, 2009 Rahul Hi Again, the version we are working with is version 3.00. Indeed if we remove the 100% and replace it with a number all is well. the problem is that we cannot predetermine the width of the chart to a specific number. that is why we are using the 100%. if we remove it the chart will not necessariliy spread on the page and that is problematic. Can you think of a solution for that? Best Reagrds, Ilan. Share this post Link to post Share on other sites
Rahul Kumar Report post Posted January 15, 2009 Hi, Could you please try updating gantt chart once and then try using % width, height ? Also here is one trick that you could try, which is use %25 instead of just %, we have not tested it extensively but give it a try. So your previous code becomes: sb.Append("var myChart = new FusionCharts('../FusionGadgets_Developer/Charts/Gantt.swf', 'chartId', '100%25', '" + hight + "', '0', '1');"); Please let us know, if this worked for you. Share this post Link to post Share on other sites
[email protected] Report post Posted January 18, 2009 Hi again, we downloaded the update (veriosn 3.02) and replace the '100%' with '100%25'. I am sorry to inform you that it didn't fix the problem. Currently we replaced the 100% with a number but this is not a complete solution. if you have some more ideas I would be happy to know about. Best Regards, Ilan. Share this post Link to post Share on other sites
Rahul Kumar Report post Posted January 19, 2009 Hi, The issue might be that, you are creating the div dynamically and immediately you are rendering the chart, so at this instance chart is not getting div width, in result using 0 for width. Share this post Link to post Share on other sites