ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Chart does not displayed on Sharepoint
Posted by ShareDev on Oct-05-2010 19:34
Hi Experts,

I have created UserControl which populates charts based on some data. I have tested that UserControl in asp.net it is working fine.

I have created webpart using that UserControl  and Integrated that webpart in sharepoint. In sharepoint I have added assembly of my webpart in GAC, Added all dll files including "netchartdir.dll" in SafeControl list in web.config of sharepoint site.

I am able to view the sharepoint webpart and text data which am displaying but however I am unable to see the Graph. A blank image with red cross(X) on the Top-Right is displayed.

Please provide your assistance to resolve this issue.

  Re: Chart does not displayed on Sharepoint
Posted by Peter Kwan on Oct-06-2010 03:40
Hi ShareDev,

To diagnose the problem, please kindly inform me what is the error message inside the "red X". If you are not sure how to obtain the error message, please refer to the following article:

http://www.chartdir.com/forum/download_thread.php?site=chartdir&bn=chartdir_faq&thread=1117817200

Without seeing the error message, my wild guess is that the problem is related to either the session variables or to the routing of the <IMG> request.

In HTML/HTTP, it is illegal to include an image in HTML. So your HTML cannot contain any image, but can contain an <IMG> tag. The <IMG> tag will load the image using a separate HTTP request.

If you can see the text data, and the "red X", it probably means the HTML is working (it does contain the <IMG> tag). But the <IMG> tag cannot load the image using a separate HTTP request. The two most common reasons are:

(a) The server is not sure that the HTTP request from the <IMG> tag is from the same user as the HTTP request for the HTML. For dynamically generated images, the server can only send the chart image to the HTML that generates the chart image. (Obviously, you do not want to send the chart image to a different user.) The ASP.NET system keeps track of this information using sessions (which uses cookies or other means). If for some reasons, the session is broken, the server will refuse to send the image to the browser.

(b) When the server receives the HTTP request from the <IMG> tag, the request should be handled by the WebChartViewer. Normally, the WebChartViewer would intercept the request during Page_Init, and handle the request immediately and the terminate it. However, if the WebChartViewer does not exist (eg. the system may only create the WebChartViewer dynamically during Page_Load or later), it will miss the <IMG> tag request. The request will go to the Page_Load stage, which runs your code. As your code probably cannot handle this type of request, it will send a non-image to the <IMG> tag, resulting in the "red X".

To solve the above types of problem, one method is to store the chart image as a temporary file on the hard disk. The server will then treat the <IMG> tag request as a static image file request, not an ASP.NET request, and the above issue will not occur. See BaseChart.makeTmpFile for more information on this method.

Regards
Peter Kwan