**** Her er hele koden - Jeg har øget points lidt *****
<%
// Chart standard values
Set chart = Server.CreateObject(\"ChartFX.WebServer\")
chart.RgbBk = RGB(255,255,255)
chart.SerLegBox = True
chart.Axis(AXIS_Y).Decimals = 0
chart.Axis(AXIS_X).Font.Name = \"Arial\"
chart.Axis(AXIS_X).Font.Size = \"7\"
chart.Printer.ForceColors = TRUE
chart.TopFont.Name = \"Arial\"
chart.TopFont.Bold = TRUE
chart.TopFont.Size = 8
chart.Axis(AXIS_Y1).Grid = TRUE
chart.PointLabels = TRUE
%>
<%
// get related
Set db_related = Server.CreateObject(\"ADODB.Connection\")
db_related.Open connstr
SQL_query = \"SELECT chart_related FROM chartdata WHERE chart_id = \" & select_question
Set db_related = db_related.Execute(SQL_query)
chartloop = db_related.Fields.Item(\"chart_related\")
redim chartloop2(chartlen+1)
chartloop2(0) = select_question
if chartloop <> EOF AND cstr(select_area) = \"5\" then
chartloop = SPLIT(chartloop,\",\")
chartlen = UBOUND(chartloop)
chartlen = chartlen + 1
for reloop = 0 to chartlen
chartloop2(i+1) = chartloop(i)
next
end if
// Loop number of charts
for loopnb = 0 to chartlen
chartnb = chartloop2(loopnb)
// get chart info
Set db_chartinfo = Server.CreateObject(\"ADODB.Connection\")
db_chartinfo.Open connstr
SQL_query = \"SELECT chartdata.product_id, chartdata.area_id, chartdata.chart_question, chartdata.chart_conclusion FROM chartdata WHERE chart_id = \" & chartnb
Set db_chartinfo = db_chartinfo.Execute(SQL_query)
chart.title(2) = db_chartinfo.Fields.Item(\"chart_question\").Value
select_area2 = db_chartinfo.Fields.Item(\"area_id\").Value
select_area2 = SPLIT(select_area2,\",\")
select_area3 = select_area2(0)
product = db_chartinfo.Fields.Item(\"product_id\").Value
product = SPLIT(product,\",\")
productlen = UBOUND(product)
%>
<div align=\"center\"></div>
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" width=\"150\">
<tr>
<td colspan=\"3\" bgcolor=\"#848284\"><img src=\"
file:///E|/Inetpub/wwwroot/mip/Trans.gif\" width=\"1\" height=\"1\"></td>
</tr>
<tr>
<td bgcolor=\"#848284\"><img src=\"
file:///E|/Inetpub/wwwroot/mip/Trans.gif\" width=\"1\" height=\"1\"></td>
<td height=\"30\">
<div align=\"center\"><font size=\"3\"><b><font face=\"Verdana, Arial, Helvetica, sans-serif\">
<%
for productcounter = 0 to productlen
if product(productcounter) = 1 then response.write(\"Playstation\")
if product(productcounter) = 2 then response.write(\"PC Games\")
if product(productcounter) = 3 then response.write(\"Sell-thru\")
if product(productcounter) = 4 then response.write(\"Rental\")
if product(productcounter) = 5 then response.write(\"DVD\")
if product(productcounter) = 6 then response.write(\"Theatrical\")
if productcounter < productlen then response.write(\"/\")
next
%>
</font><font size=\"3\"><b>
<%
if select_area3 = 1 then response.write(\"<img src=\'dk.gif\' width=\'15\' height=\'15\'>\")
if select_area3 = 2 then response.write(\"<img src=\'se.gif\' width=\'15\' height=\'15\'>\")
if select_area3 = 3 then response.write(\"<img src=\'no.gif\' width=\'15\' height=\'15\'>\")
if select_area3 = 4 then response.write(\"<img src=\'fi.gif\' width=\'15\' height=\'15\'>\")
%>
</b></font></b></font></div>
</td>
<td bgcolor=\"#848284\"><img src=\"
file:///E|/Inetpub/wwwroot/mip/Trans.gif\" width=\"1\" height=\"1\"></td>
</tr>
</table>
<%
Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open connstr
if select_charttype = 0 then
Set RS = Conn.Execute(\"SELECT labels.question_name, background.background_name, val.value FROM (val INNER JOIN background ON val.background = background.background_id) INNER JOIN labels ON (val.question = labels.question_id) AND (val.chart = labels.chart_id) WHERE (((val.chart)=\" & chartnb & \") AND ((val.category)=\" & select_background & \")) ORDER BY val.val_id;\")
chart.Scrollable = TRUE
\'chart.Axis(AXIS_X).SetScrollView 1,markerval
chart.SerLegBox = TRUE
chart.PointLabels = TRUE
chart.gallery = BAR
end if
if select_charttype = 1 then
Set RS = Conn.Execute(\"SELECT background.background_name AS background, labels.question_name AS question, val.value AS val FROM (val INNER JOIN background ON val.background = background.background_id) INNER JOIN labels ON (val.question = labels.question_id) AND (val.chart = labels.chart_id) WHERE (((val.chart)=\" & chartnb & \") AND ((val.category)=\" & select_background & \")) ORDER BY labels.question_id, background.background_id;\")
chart.SerLegBox = FALSE
chart.PointLabels = TRUE
chart.Gallery = PIE
end if
if select_charttype = 2 then
Set RS = Conn.Execute(\"SELECT background.background_name AS background, labels.question_name AS question, val.value AS val FROM (val INNER JOIN background ON val.background = background.background_id) INNER JOIN labels ON (val.question = labels.question_id) AND (val.chart = labels.chart_id) WHERE (((val.chart)=\" & chartnb & \") AND ((val.category)=\" & select_background & \")) ORDER BY labels.question_id, background.background_id;\")
chart.Scrollable = TRUE
\'chart.Axis(AXIS_X).SetScrollView 1,markerval
chart.SerLegBox = TRUE
chart.PointLabels = TRUE
chart.gallery = BAR
end if
if select_charttype = 3 then
Set RS = Conn.Execute(\"SELECT val.val_id, labels.question_name, background.background_name, val.value, 1 as rank FROM (val INNER JOIN background ON val.background = background.background_id) INNER JOIN labels ON (val.chart = labels.chart_id) AND (val.question = labels.question_id) WHERE (((val.chart)=\" & chartnb & \") AND ((val.category)=\" & select_background & \")) ORDER BY val.val_id UNION SELECT val.val_id, labels.question_name, background.background_name, val.value, 2 as rank FROM (val INNER JOIN background ON val.background = background.background_id) INNER JOIN labels ON (val.chart = labels.chart_id) AND (val.question = labels.question_id) WHERE (((val.chart)=\" & chartnb & \") AND ((val.category)=1)) ORDER BY rank, val.val_id\")
chart.Scrollable = TRUE
\'chart.Axis(AXIS_X).SetScrollView 1,markerval
chart.SerLegBox = TRUE
chart.PointLabels = TRUE
chart.Cluster = TRUE
chart.AngleX = 30
chart.AngleY = 65
chart.View3D = TRUE
chart.gallery = BAR
end if
if select_charttype = 4 then
Set RS = Conn.Execute(\"SELECT background.background_name AS background, labels.question_name AS question, val.value AS val FROM (val INNER JOIN background ON val.background = background.background_id) INNER JOIN labels ON (val.question = labels.question_id) AND (val.chart = labels.chart_id) WHERE (((val.chart)=\" & chartnb & \") AND ((val.category)=\" & select_background & \")) ORDER BY labels.question_id, background.background_id;\")
chart.Scrollable = TRUE
\'chart.Axis(AXIS_X).SetScrollView 1,markerval
chart.SerLegBox = TRUE
chart.PointLabels = TRUE
chart.gallery = BAR
end if
Dim chartarray
chartarray = RS.GetRows
nb = ubound(chartarray, 2) + 1
redim notused1(nb)
redim ColumnH(nb)
redim RowH(nb)
redim ValueH(nb)
redim notused2(nb)
if select_charttype <> 3 then
for i = 0 to ubound(chartarray, 2)
ColumnH(i) = chartarray(0,i)
RowH(i) = chartarray(1,i)
ValueH(i) = chartarray(2,i)
next
end if
if select_charttype = 3 then
for i = 0 to ubound(chartarray, 2)
notused1(i) = chartarray(0,i)
ColumnH(i) = chartarray(1,i)
RowH(i) = chartarray(2,i)
ValueH(i) = chartarray(3,i)
notused2(i) = chartarray(4,i)
next
end if
Set CfxArray = Server.CreateObject(\"CfxData.Array\")
CfxArray.AddArray ColumnH
CfxArray.AddArray RowH
CfxArray.AddArray ValueH
Set CfxCrosstab = Server.CreateObject(\"SfxCrosstab.DataProvider\")
CfxCrosstab.DataSource = CfxArray
CfxCrosstab.DataType(0) = CTDT_COLUMNHEADING
CfxCrosstab.DataType(1) = CTDT_ROWHEADING
CfxCrosstab.DataType(2) = CTDT_VALUE
Chart.GetExternalData CfxCrosstab
if select_annotation = 1 then
chart.bottomgap = 100
Set annotx = Server.CreateObject(\"AnnotationX.AnnList\")
chart.AddExtension annotx
Set Obj = annotx.Add(6)
Obj.Text = db_chartinfo.Fields.Item(\"chart_conclusion\").Value
Obj.Top = 500
Obj.Left = 100
Obj.height = 50
Obj.width = 450
end if
%>
<%= chart.GetHtmlTag(select_brwidth,select_brheight,\"ActiveX\") %>
<div align=\"center\"><br>
<br>
<%
\'Set chart = nothing
Set CfxArray = nothing
Set CfxCrosstab = nothing
next