Multiple Pie3D charts
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        


12»»

Multiple Pie3D charts Expand / Collapse
Author
Message
Posted 1/22/2008 10:17:28 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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.
Post #4008
Posted 1/22/2008 11:24:12 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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

Post #4015
Posted 1/25/2008 7:05:25 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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.

Post #4111
Posted 1/25/2008 1:02:51 PM
FusionCharts Team

FusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts 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
Post #4123
Posted 1/28/2008 12:55:35 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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.

  Post Attachments 
GPlanta.rar (7 views, 2.49 KB)
Post #4172
Posted 1/28/2008 11:21:37 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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

Post #4195
Posted 1/29/2008 12:56:35 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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...
Post #4216
Posted 1/30/2008 12:38:50 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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

Post #4225