Click here to Skip to main content
13,138,411 members (50,371 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi all

I am trying to use chart control in 3.5

I installed MSChart.exe and implemented the chart control.
In Local it is showing image but in Server it is not showing image every time.
Means:After Uploaded the code to the server the images are showing sometime.

In a page i have used two chart control.Some time it is showing image of 1st Chart control and sometime others.

It is showing error IMAGE NOT FOUND.

In the Web.Config file i have added
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
<add key="ChartImageHandler" value="Storage=file;Timeout=60;Url=~/tempImages/;"/>

Please help to solve this problem.

Thanks in advance.
Posted 16-Aug-12 2:28am
AlluvialDeposit 16-Aug-12 8:36am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Add under handlers web.config:
 <remove name="ChartImageHandler" />
 <add name="ChartImageHandler" precondition="integratedMode" verb="GET,HEAD">
       path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

also check permissions

<location path="ChartImg.axd">
       <allow users="*"/>

Edit after question
Refer this link[^]

More link for reference
I suggest refer this thread too[^][^]
MAC123456 16-Aug-12 9:21am
I have added above handler with that i have to add these handler ???
Anuja Pawar Indore 16-Aug-12 9:27am
Yes under system.webserver add handlers
MAC123456 16-Aug-12 9:44am
is permissions check is required???
Anuja Pawar Indore 16-Aug-12 9:47am
If your page is only accessed by logged in user's or may be your folder access problem. Check both
MAC123456 16-Aug-12 9:59am
I am doing in local and its working fine.
I will inform you if it will not show any error in server.

Thanks for immediate reply.
Thanks a ton.
MAC123456 16-Aug-12 10:09am
Hi Anuja
Can you share why it is not showing the image???
MAC123456 16-Aug-12 10:11am
Can you please share the full description why not the images are not showing and why after use that one it is showing ???
MAC123456 17-Aug-12 1:22am
It is not working in server again .

These codes are already written in the server code.
MAC123456 17-Aug-12 1:23am
Please improve your solution.
Anuja Pawar Indore 17-Aug-12 1:27am
MAC its permission issue, pls check ur folder and path permission. May be server path generating is wrong.
MAC123456 17-Aug-12 2:05am
I am not using MAC.
How to Solve the server path generating.
My problem:
I have made an User Control in which i have used two Chart Controls.
In Chrome and FireFox the images are coming Sometime.But in IE it is showing two images.
In Chrome and FireFox Sometime one image is showing and sometime nothing is showing means NO IMAGE FOUND.
Please solve this
Anuja Pawar Indore 17-Aug-12 4:14am
Added some more references, if still having problem then share your code
MAC123456 17-Aug-12 7:19am
My Code: ASPX Page

<%@ Register Assembly="System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<asp:Chart ID="chartLeadAssociation" runat="server" Width="1000px" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)">
<asp:Series Name="seriesLeadAssociation" XValueMember="LEADER_NAME" XValueType="String"
YValueMembers="START_DATE, END_DATE" YValueType="DateTime" ChartType="RangeBar">

<asp:ChartArea Name="chartAreaLeadAssociation">
<AxisX Interval="1" Title="Worked with..">

<AxisY Title="Time..">
<LabelStyle Angle="-90" />

<asp:Chart ID="chartProjectAssociation" runat="server" Width="1000px" ImageLocation="~/TempImages/Chart1Pic_#SEQ(300,3)">
<asp:Series Name="seriesProjectAssociation" XValueMember="PROJECT_NAME" XValueType="String"
YValueMembers="START_DATE, END_DATE" YValueType="DateTime" ChartType="RangeBar" Color="Orange">

<asp:ChartArea Name="chartAreaProjectAssociation">
<AxisX Interval="1" Title="Projects..">

<AxisY Title="Time..">
<LabelStyle Angle="-90" />

<asp:Label ID="lblError" runat="server">
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

This is my code and is working fine
<asp:Chart ID="chartColumn" runat="server" BackColor="WhiteSmoke" BackSecondaryColor="White"BackGradientStyle="TopBottom" BorderDashStyle="Solid" Palette="BrightPastel"
BorderColor="26, 59, 105" Height="460px" Width="530px" BorderWidth="2" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)">
<Legends><asp:Legend Name="Default" BackColor="Transparent" Font="Trebuchet MS, 8pt, style=Bold"
AutoFitMinFontSize="6" Docking="Top" LegendStyle="Table" ForeColor="Red"> </asp:Legend>
 </Legends><BorderSkin SkinStyle="Emboss"></BorderSkin> <Series> </Series>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" BackSecondaryColor="White" BackColor="Gainsboro" ShadowColor="Transparent" BackGradientStyle="TopBottom">
 <Position Height="85" Width="90" X="4" Y="5" />
<AxisY LineColor="64, 64, 64, 64" IsLabelAutoFit="False"><LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
<AxisX LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" IntervalType="Auto" /><MajorGrid Interval="Auto" IntervalType="Auto" LineColor="64, 64, 64, 64" />
<MajorTickMark IntervalType="Auto" />

Method code behind
public void FillChart(int DId)
        // Set legend docking i.e position of the legends
        chartColumn.Legends["Default"].Docking = Docking.Bottom;
        // Set legend alignment
        chartColumn.Legends["Default"].Alignment = System.Drawing.StringAlignment.Center;
        // Set legend style Column / Row / Table
        chartColumn.Legends["Default"].LegendStyle = LegendStyle.Table;
        PID = Convert.ToInt32(ViewState["PatId"].ToString());
        CmsIdentity objIdentity = (CmsIdentity)Context.User.Identity;
        DataSet dsChart = new DataSet();
        clsPatientEPRResultsDb objResultDb = new clsPatientEPRResultsDb();
           dsChart = objResultDb.GetTestResultForChart(DId, PID, objIdentity.AccountInfoID, "");
        if (dsChart.Tables[0].Rows.Count > 0)
            chartColumn.Visible = true;
            DataView dv = dsChart.Tables[0].DefaultView;
            seriesname = "Result";
            chartColumn.Series[seriesname].ChartArea = "ChartArea1";
            chartColumn.Series[sername].ChartType =   SeriesChartType.Column;
            chartColumn.Series[sername].Palette = ChartColorPalette.BrightPastel;
            chartColumn.Series[seriesname].Name = seriesname;
            chartColumn.Series[seriesname].Color = System.Drawing.Color.Red;
            chartColumn.Series[seriesname].IsValueShownAsLabel = true;
            chartColumn.Series[seriesname].Points.DataBindXY(dv, "ResultDate1", dv, "Result");
            string CharPic = Server.MapPath("TempPDF/") + "Result(" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ").jpeg";
            chartColumn.SaveImage(CharPic, ChartImageFormat.Jpeg);
            chartColumn.Series[seriesname].Points.DataBindXY(dv, "ResultDate1", dv, "Result");

Please see if this solves your problem, as i cannot see any problem in your code.
MAC123456 20-Aug-12 3:44am
Actually i am using two chart control in a page.
Is that showing problem??
I have to do this using two Chart Control?????

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 17 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100