This:
strSavePath = Server.MapPath(".") & "\Sample.gif"
Chartspace1.ExportPicture(strSavePath, "gif", 1024, 768)
Image1.ImageUrl = strSavePath
doesn't work because strSavePath is the local path on the server. It doesn't
exist on the client's machine. If you want your way to work, do just
Image1.ImageUrl = "Sample.gif"
But you should rather do the following:
Response.ContentType= "image/gif";
Response.BinaryWrite((byte[])Chartspace1.GetPicture("gif",1024,768));
Response.End();
and set the ImageUrl to the name of the page that builds the chart.
Eliyahu
Khurram Shamim Siddiqui said:
Thanks for quick reply, I am doing the same, as I mentioned earlier
"creating graph with ChartSpace1 object and after creating "GIF" file I am
showing it in browser in Image control." that is the same technique you
describe, the above described GIF is Streamed to client as an image. Here
is
the code below.
'******************************************
Dim categories, values, c
Dim strSavePath As String
Dim DTRecords As DataTable
Dim dRow As DataRow
categories = ""
values = ""
DTRecords = GetCityAmount()
For Each dRow In DTRecords.Rows
categories = categories & dRow("City").ToString & Chr(9)
values = values & dRow("AmountMonthly").ToString & Chr(9)
Next
' Remove the leftover tab character at the end of the strings.
categories = Left(categories, Len(categories) - 1)
values = Left(values, Len(values) - 1)
' Create a chart with one series (called "AmountMonthly").
ChartSpace1.Clear()
ChartSpace1.Charts.Add()
ChartSpace1.Charts(0).SeriesCollection.Add()
Chartspace1.Charts(0).SeriesCollection(0).Caption = "Cities"
'Set the series categories and values using the strings created
from
the DataSet.
c = ChartSpace1.Constants
ChartSpace1.Charts(0).SeriesCollection(0).SetData(c.chDimCategories,
c.chDataLiteral, categories)
ChartSpace1.Charts(0).SeriesCollection(0).SetData(c.chDimValues,
c.chDataLiteral, values)
' Set the chart type and format the axis as $.
Chartspace1.Charts(0).Type =
OWC11.ChartChartTypeEnum.chChartTypeBar3D 'c.chChartTypeBarClustered
Chartspace1.Charts(0).Axes(c.chAxisPositionBottom).NumberFormat =
"$#,##0"
strSavePath = Server.MapPath(".") & "\Sample.gif"
Chartspace1.ExportPicture(strSavePath, "gif", 1024, 768)
Image1.ImageUrl = strSavePath
'******************************************