|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 3/5/2008 5:00:25 PM
Posts: 9,
Visits: 42
|
|
I want to show 4 charts on a same page, eah one in a different DIV. I have the Query running, and as far i can see, the XML is beign properly made using concatenation.
The thing is I am using one method (imprimechart) to populate each chart (I use a string to see witch chart I am building). I think the code generating the XML is correct, but i still get the "chart" text on all DIVs.
Here's the code on the aspx page
< div style="z-index: 106; left: 56px; width: 250px; position: absolute; top: 88px;
height: 250px" id="P1-P2">
< % = imprimeChart("P1-P2") %>
< /div>
< div style="z-index: 107; left: 320px; width: 250px; position: absolute; top: 88px;
height: 250px" id="P2-P3">
< % = imprimeChart("P2-P3") %>
< /div>
< div id="P3-P4" style="z-index: 108; left: 56px; width: 250px; position: absolute;
top: 352px; height: 250px">
< % = imprimeChart("P3-P4") %>
< /div>
< div id="P2-P5" style="z-index: 109; left: 320px; width: 250px; position: absolute;
top: 352px; height: 250px">
< % = imprimeChart("P2-P5") %>
< /div>
and the CS code
public string imprimeChart(string Div)
{
string dataXML = "< chart caption='" + Div + "' formatNumberScale='0'>";
int columna = 0,criterio = 0, buenos = 0, malos = 0;
switch (Div)
{
case "P1-P2":
columna = 2;
criterio = 5;
break;
case "P2-P3":
columna = 3;
criterio = 17;
break;
case "P2-P4":
columna = 4;
criterio = 20;
break;
case "P2-P5":
columna = 5;
criterio = 25;
break;
}
//ve cada fila de la columna elegida para el gráfico en proceso
foreach (DataRow fila in tablaGP.Rows)
{
if (Convert.ToInt32(fila[columna]) > criterio)
malos = malos + 1;
else
buenos = buenos + 1;
}
dataXML = dataXML + " < set label='Buenos' value='" + buenos.ToString() + "'/ > < set label='Malos' value='" + malos.ToString() + "'/ > < /chart>";
return FusionCharts.RenderChart("FusionCharts/Pie3D.swf", "", dataXML, Div, "600", "300", false, false);
}
I think the problem is on the aspx page or in the return of the method. Maybe i'm not stating properly the DIV's ID to separate each chart.
|
|
|
|
|
Supreme Being
      
Group: Moderators
Last Login: Today @ 8:31:36 AM
Posts: 763,
Visits: 1,214
|
|
| hi, It might be that you have not added/included FusionCharts.js script in <script> tag in the HTML - HEAD part of your aspx file.
Regards,
Sudipto Choudhury FusionCharts Team
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 3/5/2008 5:00:25 PM
Posts: 9,
Visits: 42
|
|
Hi
I checked the code but I do have the 'script language="JavaScript" src="FusionCharts/FusionCharts.js" /script' in the Head tag of the page. Also I checked with sample data to see if the problem could be the XML was sending charts with no data inside, but still I get the 'Chart' text on each Div... not even the 'no data to display' message.
|
|
|
|
|
FusionCharts Team
      
Group: Administrators
Last Login: 7/29/2008 12:15:49 PM
Posts: 2,001,
Visits: 474
|
|
Hi
Can you please send the complete HTML output as attachment?
Thanks, Pallav Nadhani FusionCharts Team
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 3/5/2008 5:00:25 PM
Posts: 9,
Visits: 42
|
|
Sorry about the delay. Here's the asp and the cs code.
|
|
|
|
|
Supreme Being
      
Group: Moderators
Last Login: Today @ 8:31:36 AM
Posts: 763,
Visits: 1,214
|
|
| hi, I have a quick view of your code and i trapped some javascript errors. The div ids that you have defined are having '-' character which is not permissible in JavaScript. can you please replace the character with say, '_' and things will work. e.g. <div style="z-index: 106; left: 56px; width: 250px; position: absolute; top: 88px; height: 250px" id="P1_P2"> <% = imprimeChart("P1_P2") %> </div> Moreover, the size of the chart are bigger (600x300) than the container (250x250). Please set the size of the charts too: return FusionCharts.RenderChart("FusionCharts/Pie3D.swf", "", dataXML, Div, "250", "250", false, false);
Regards,
Sudipto Choudhury FusionCharts Team
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 3/5/2008 5:00:25 PM
Posts: 9,
Visits: 42
|
|
I made the change on the DIV's IDs and voila! the charts worked wonderfully!
I can't believe something that simple kept me stucked this long... better go hit some books 'bout javascript 
thanks for your help, you guys really rock !
Just a lttle concern. I don't know why the first chart loks normal while the others 3 the pie is a lot smaller than the first one... but they're visible...
|
|
|
|
|
Supreme Being
      
Group: Moderators
Last Login: Today @ 8:31:36 AM
Posts: 763,
Visits: 1,214
|
|
| hi, can you just send us a screenshot of the page?
Regards,
Sudipto Choudhury FusionCharts Team
|
|
| |