Click to See Complete Forum and Search --> : Chart on web


faamugol
08-08-2006, 03:22 AM
Good morning,

After installing the next component, the page fails to dsiplay the image.
It displays only uncommon caracters. an anybody help me to find out the issue or do someone know any other chart easy to use.

<%@ language="vbscript" %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<img src="ChartGen.asp"/>
<P>&nbsp;</P>

<%
Set cd = Server.CreateObject("ChartDirector.API")

' The data for the bar chart
data = Array(5, 20, 25, 19, 15)

' The labels for the bar chart
labels = Array("Mon", "Tue", "Wed", "Thu", "Fri")

' Create a XYChart object of size 250 x 250 pixels
Set c = cd.XYChart(250, 250)

' Set the plotarea at (30, 20) and of size 200 x 200 pixels
Call c.setPlotArea(30, 20, 200, 200)

' Add a bar chart layer using the given data
Call c.addBarLayer(data)

' Set the labels on the x axis.
Call c.xAxis().setLabels(labels)

' output the chart
'Response.ContentType = "image/jpg"
'Response.BinaryWrite c.makeChart2(cd.jpg)

Response.ContentType = "image/png"
Response.BinaryWrite c.makeChart2(cd.PNG)
Response.End
%>

</BODY>
</HTML>

Thanks in advance

Ubik
09-05-2006, 05:42 PM
You will need to have the ChartDirector.API installed on your webserver.

Having that, you will need to create TWO files, not just the one you have:

chart.asp:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>This Is The Chart</title>
</head>

<body>

<p>Chart:<br /><img src="ChartGen.asp" /></p>

</body>
</html>


and then ChartGen.asp:


<%@ language="vbscript" %>
<%
Set cd = Server.CreateObject("ChartDirector.API")

' The data for the bar chart
data = Array(5, 20, 25, 19, 15)

' The labels for the bar chart
labels = Array("Mon", "Tue", "Wed", "Thu", "Fri")

' Create a XYChart object of size 250 x 250 pixels
Set c = cd.XYChart(250, 250)

' Set the plotarea at (30, 20) and of size 200 x 200 pixels
Call c.setPlotArea(30, 20, 200, 200)

' Add a bar chart layer using the given data
Call c.addBarLayer(data)

' Set the labels on the x axis.
Call c.xAxis().setLabels(labels)

' output the chart
'Response.ContentType = "image/jpg"
'Response.BinaryWrite c.makeChart2(cd.jpg)

Response.ContentType = "image/png"
Response.BinaryWrite c.makeChart2(cd.PNG)
Response.End
%>


Hope that helps.

Note: I do not have the API installed, so YMMV, I got this error:

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/ChartGen.asp, line 3

800401f3


I would have liked that API, it looks cool.

One thing you can do is finagle tables (gaaack!) to display crude barcharts, using percentages in height and width values.

russell_g_1
09-06-2006, 03:23 PM
you can get a picture of a chart out of ms excel if you try.