Sign in to follow this  
PUDYASTO

Multiseries With Asp

Recommended Posts

Now I use ASP, can help me, this is my source code

 

<%@ Language=VBScript %>

<HTML>

<HEAD>

<TITLE> FusionCharts - Array Example using Multi Series Column 3D Chart </TITLE>

<script LANGUAGE="Javascript" SRC="JS/FusionCharts.js"></SCRIPT>

</HEAD>

<!-- #INCLUDE FILE="FusionCharts.asp" -->

<!-- #INCLUDE FILE="DBConn.asp" -->

<BODY>

<center>

<%

Dim oRs, oRs2, strQuery

Dim strXML, s

Set oRs = Server.CreateObject("ADODB.Recordset")

strQuery = "select top 10 a.* from (select kdpel as Kode_Pel , " & _

"SUM(case when kd_brg = '2-01-02-01-0005' then qty else 0 end) as MKIOS_05, " & _

"SUM(case when kd_brg = '2-01-02-01-0010' then qty else 0 end) as MKIOS_10, " & _

"SUM(case when kd_brg = '2-01-02-01-0020' then qty else 0 end) as MKIOS_20, " & _

"SUM(case when kd_brg = '2-01-02-01-0025' then qty else 0 end) as MKIOS_25, " & _

"SUM(case when kd_brg = '2-01-02-01-0050' then qty else 0 end) as MKIOS_50 " & _

"from IMPORTJUAL group by kdpel ) a "

Set oRs = oConn.Execute(strQuery)

'do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

'response.Write(oRs.Fields("Kode_Pel").value)

'oRs.movenext

'next

'loop

%>

<%

strXML = "<chart caption='Sales by Product' numberPrefix='' formatNumberScale='0' rotateValues='1' placeValuesInside='1' decimals='0' >"

strCategories = "<categories>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

strCategories = strCategories & "<category label='" & oRs.Fields("Kode_Pel").value & "' />"

oRs.movenext

'next

loop

strCategories = strCategories & "</categories>"

strDataCurr = "<dataset seriesName='MKIOS_05' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

strDataCurr = strDataCurr & "<set value='" & oRs.Fields("MKIOS_05").value & "' />"

oRs.movenext

'next

loop

strDataCurr = strDataCurr & "</dataset>"

strDataPrev = "<dataset seriesName='MKIOS_10' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

strDataPrev = strDataPrev & "<set value='" & oRs.Fields("MKIOS_10").value & "' />"

oRs.movenext

'next

loop

strDataPrev = strDataPrev & "</dataset>"

strXML = strXML & strCategories & strDataCurr & strDataPrev & "</chart>"

Call renderChart("Charts/MSColumn3D.swf", "", strXML, "productSales", 600, 300, false, false)

%>

</center>

</BODY>

</HTML>

Result is My chart cannot show, can you help me?

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Welcome to FusionCharts Forum!smile.gif

 

Could you please send us the generated XML code to look into the issue?

 

Awaiting for your response.

Share this post


Link to post
Share on other sites

Hi,

 

Welcome to FusionCharts Forum!smile.gif

 

Could you please send us the generated XML code to look into the issue?

 

Awaiting for your response.

 

I've used generate XML code from variable like this :

 

 

strXML = "<chart caption='Factory Output report' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units'>"

 

strCategories = "<categories>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

strCategories = strCategories & "<category label='" & oRs.Fields("Kode_Pel").value & "' />"

'next

oRs.movenext

loop

strCategories = strCategories & "</categories>"

 

x1 = "<dataset seriesName='MKIOS_05' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

x1 = x1 & "<set value='" & oRs.Fields("MKIOS_05").value & "' />"

'next

oRs.movenext

loop

x1 = x1 & "</dataset>"

 

x2 = "<dataset seriesName='MKIOS_10' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

x2 = x2 & "<set value='" & oRs.Fields("MKIOS_10").value & "' />"

'next

oRs.movenext

loop

x2 = x2 & "</dataset>"

 

x3 = "<dataset seriesName='MKIOS_20' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

x3 = x3 & "<set value='" & oRs.Fields("MKIOS_20").value & "' />"

'next

oRs.movenext

loop

x3 = x3 & "</dataset>"

 

x4 = "<dataset seriesName='MKIOS_25' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

x4 = x4 & "<set value='" & oRs.Fields("MKIOS_25").value & "' />"

'next

oRs.movenext

loop

x4 = x4 & "</dataset>"

 

x5 = "<dataset seriesName='MKIOS_50' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

x5 = x5 & "<set value='" & oRs.Fields("MKIOS_50").value & "' />"

'next

oRs.movenext

loop

x5 = x5 & "</dataset>"

 

 

strXML = strXML & strCategories & x1 & x2 & x3 & x4 & x5 & "</chart>"

 

 

in this case, categories will show, but not with data, I don't know why it happen?

post-20028-0-27517300-1313042250_thumb.jpg

Share this post


Link to post
Share on other sites

I've used generate XML code from variable like this :

 

 

strXML = "<chart caption='Factory Output report' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units'>"

 

strCategories = "<categories>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

strCategories = strCategories & "<category label='" & oRs.Fields("Kode_Pel").value & "' />"

'next

oRs.movenext

loop

strCategories = strCategories & "</categories>"

 

x1 = "<dataset seriesName='MKIOS_05' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

x1 = x1 & "<set value='" & oRs.Fields("MKIOS_05").value & "' />"

'next

oRs.movenext

loop

x1 = x1 & "</dataset>"

 

x2 = "<dataset seriesName='MKIOS_10' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

x2 = x2 & "<set value='" & oRs.Fields("MKIOS_10").value & "' />"

'next

oRs.movenext

loop

x2 = x2 & "</dataset>"

 

x3 = "<dataset seriesName='MKIOS_20' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

x3 = x3 & "<set value='" & oRs.Fields("MKIOS_20").value & "' />"

'next

oRs.movenext

loop

x3 = x3 & "</dataset>"

 

x4 = "<dataset seriesName='MKIOS_25' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

x4 = x4 & "<set value='" & oRs.Fields("MKIOS_25").value & "' />"

'next

oRs.movenext

loop

x4 = x4 & "</dataset>"

 

x5 = "<dataset seriesName='MKIOS_50' showValues='0'>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

x5 = x5 & "<set value='" & oRs.Fields("MKIOS_50").value & "' />"

'next

oRs.movenext

loop

x5 = x5 & "</dataset>"

 

 

strXML = strXML & strCategories & x1 & x2 & x3 & x4 & x5 & "</chart>"

 

 

in this case, categories will show, but not with data, I don't know why it happen?

 

I've got solution by myself, this is my code for multiseries :

 

 

<%@ Language=VBScript %>

<HTML>

<HEAD>

<TITLE> FusionCharts - Array Example using Multi Series Column 3D Chart </TITLE>

<script LANGUAGE="Javascript" SRC="JS/FusionCharts.js"></SCRIPT>

</HEAD>

<!-- #INCLUDE FILE="FusionCharts.asp" -->

<!-- #INCLUDE FILE="DBConn.asp" -->

<BODY>

<center>

<%

Dim oRs, oRs2, strQuery

Dim strXML, s

 

Set oRs = Server.CreateObject("ADODB.Recordset")

 

strQuery = "select top 10 a.* from (select kdpel as Kode_Pel , " & _

"SUM(case when kd_brg = '2-01-02-01-0005' then qty else 0 end) as MKIOS_05, " & _

"SUM(case when kd_brg = '2-01-02-01-0010' then qty else 0 end) as MKIOS_10, " & _

"SUM(case when kd_brg = '2-01-02-01-0020' then qty else 0 end) as MKIOS_20, " & _

"SUM(case when kd_brg = '2-01-02-01-0025' then qty else 0 end) as MKIOS_25, " & _

"SUM(case when kd_brg = '2-01-02-01-0050' then qty else 0 end) as MKIOS_50 " & _

"from IMPORTJUAL group by kdpel ) a "

 

Set oRs = oConn.Execute(strQuery)

Set oRs2 = oConn.Execute(strQuery)

Set oRs3 = oConn.Execute(strQuery)

Set oRs4 = oConn.Execute(strQuery)

Set oRs5 = oConn.Execute(strQuery)

Set oRs6 = oConn.Execute(strQuery)

 

'do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

'response.Write(oRs.Fields("Kode_Pel").value)

'oRs.movenext

'next

'loop

%>

 

<%

strXML = "<chart caption='Factory Output report' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units'>"

 

strCategories = "<categories>"

do while not oRs.eof

'for i=0 to oRs.Fields.count - 1

strCategories = strCategories & "<category label='" & oRs.Fields("Kode_Pel").value & "' />"

'next

oRs.movenext

loop

strCategories = strCategories & "</categories>"

 

x1 = "<dataset seriesName='MKIOS_05' showValues='0'>"

do while not oRs2.eof

'for i=0 to oRs.Fields.count - 1

x1 = x1 & "<set value='" & oRs2.Fields("MKIOS_05").value & "' />"

'next

oRs2.movenext

loop

x1 = x1 & "</dataset>"

 

x2 = "<dataset seriesName='MKIOS_10' showValues='0'>"

do while not oRs3.eof

'for i=0 to oRs.Fields.count - 1

x2 = x2 & "<set value='" & oRs3.Fields("MKIOS_10").value & "' />"

'next

oRs3.movenext

loop

x2 = x2 & "</dataset>"

 

x3 = "<dataset seriesName='MKIOS_20' showValues='0'>"

do while not oRs4.eof

'for i=0 to oRs.Fields.count - 1

x3 = x3 & "<set value='" & oRs4.Fields("MKIOS_20").value & "' />"

'next

oRs4.movenext

loop

x3 = x3 & "</dataset>"

 

x4 = "<dataset seriesName='MKIOS_25' showValues='0'>"

do while not oRs5.eof

'for i=0 to oRs.Fields.count - 1

x4 = x4 & "<set value='" & oRs5.Fields("MKIOS_25").value & "' />"

'next

oRs5.movenext

loop

x4 = x4 & "</dataset>"

 

x5 = "<dataset seriesName='MKIOS_50' showValues='0'>"

do while not oRs6.eof

'for i=0 to oRs.Fields.count - 1

x5 = x5 & "<set value='" & oRs6.Fields("MKIOS_50").value & "' />"

'next

oRs6.movenext

loop

x5 = x5 & "</dataset>"

 

 

strXML = strXML & strCategories & x1 & x2 & x3 & x4 & x5 & "</chart>"

 

Call renderChart("Charts/MSLine.swf", "", strXML, "productSales", 1000, 300, false, false)

 

%>

</center>

</BODY>

</HTML>

 

My wrong is how to show variable oRs, cause I've used one variable. show I create new variable for oRs and my data wil be show.

I hope can help for other newbie ^_^

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Glad to know that you have managed to resolve your problem.

 

Happy FusionCharting!biggrin.gif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this