locked
Ajax LineChart Rollover causes JavaScript error RRS feed

  • Question

  • User1344924657 posted

    When I rollover my chart to see a tooltip I get an error message pop up in debugging mode.

    JavaScript runtime error: 'ShowTooltip' is undefined

    JavaScript runtime error: 'HideTooltip' is undefined

    <cc1:LineChart ID="LCCallCenterWeeklyComparison" runat="server" EnableViewState="True" ImageStorageMode="UseImageLocation"
                                                            BaseLineColor="#A156AB" CategoryAxisLineColor="#D08AD9" ChartHeight="300"
                                                            ChartTitleColor="#0E426C" ChartType="Basic" ChartWidth="400"
                                                            ValueAxisLineColor="#D08AD9" Visible="false">
                                                        </cc1:LineChart>

    void loadcallcenterweeklycomparisonchart()
      {
          DateTime stdt = DateTime.Now.AddDays(-21);
          DateTime eddt = DateTime.Now;
          string query = string.Format("SELECT DATEADD(dd, 7-(DATEPART(dw, min(Start_Date))), min(Start_Date)) as EndOfWeek, " +
             "'Compliance %' = CONVERT(decimal(5,0), 100* SUM([TotaliCareTransfers&Conferences]) / SUM([TotalConferenceAndTransfers])) " +
         "FROM [VoipReporting].[dbo].[Softphone_Compliance] " +
         "WHERE " +
             "Start_Date Between '" + stdt + "' and '" + eddt.AddDays(+1) + "' " +
             "and CALL_CENTER = '" + ddlcallcenters.SelectedItem.Text + "' " +
         "GROUP BY datepart(week,Start_Date) ORDER BY datepart(week,Start_Date)");
          DataTable dt = GetData(query);

          string[] x = new string[dt.Rows.Count];
          decimal[] y = new decimal[dt.Rows.Count];
          for (int i = 0; i < dt.Rows.Count; i++)
          {
              x[i] = Convert.ToDateTime(dt.Rows[i][0]).ToShortDateString();
              y[i] = Convert.ToInt32(dt.Rows[i][1]);
          }
          LCCallCenterWeeklyComparison.Series.Add(new AjaxControlToolkit.LineChartSeries { Name = ddlcallcenters.SelectedItem.Text, Data = y, LineColor = "#000000" });
          LCCallCenterWeeklyComparison.CategoriesAxis = string.Join(",", x);
          LCCallCenterWeeklyComparison.ChartTitle = "Weekly Comparison";
          
          
          if (x.Length > 3)
          {
              LCCallCenterWeeklyComparison.ChartWidth = (x.Length * 75).ToString();
          }
          LCCallCenterWeeklyComparison.Visible = true;
      }

    Tuesday, August 2, 2016 4:44 PM

Answers

  • User61956409 posted

    Hi cgreene.gsu,

    When I rollover my chart to see a tooltip I get an error message pop up in debugging mode.

    JavaScript runtime error: 'ShowTooltip' is undefined

    JavaScript runtime error: 'HideTooltip' is undefined

    I create the following sample using LineChart control, I do not get the issue while displaying tooltip.

    <div>
        <asp:LineChart ID="LCCallCenterWeeklyComparison" runat="server" EnableViewState="True" ImageStorageMode="UseImageLocation"
            BaseLineColor="#A156AB" CategoryAxisLineColor="#D08AD9" ChartHeight="300"
            ChartTitleColor="#0E426C" ChartType="Basic" ChartWidth="400"
            ValueAxisLineColor="#D08AD9" Visible="false">
        </asp:LineChart>
    </div>
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Year");
            dt.Columns.Add("Value");
    
            dt.Rows.Add("2014", 80);
            dt.Rows.Add("2015", 100);
            dt.Rows.Add("2016", 90);
            dt.Rows.Add("2017", 95);
    
    
            string[] x = new string[dt.Rows.Count];
            decimal[] y = new decimal[dt.Rows.Count];
    
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                x[i] = dt.Rows[i][0].ToString();
                y[i] = Convert.ToInt32(dt.Rows[i][1]);
            }
    
            LCCallCenterWeeklyComparison.Series.Add(new AjaxControlToolkit.LineChartSeries { Name = "my chart", Data = y, LineColor = "#000000" });
            LCCallCenterWeeklyComparison.CategoriesAxis = string.Join(",", x);
            LCCallCenterWeeklyComparison.ChartTitle = "Weekly Comparison";
           
           
            //if (x.Length > 3)
            //{
            //    LCCallCenterWeeklyComparison.ChartWidth = (x.Length * 75).ToString();
            //}
            LCCallCenterWeeklyComparison.Visible = true;
        }
    }

    You could try to uninstall and reinstall the AJAX Control Toolkit.

    https://ajaxcontroltoolkit.codeplex.com/documentation

    Best Regards,

    Fei Han



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 4, 2016 9:24 AM