.NET Framework Bookmark and Share   
 index > Chart Controls for .NET Framework > How do I get AxisLabel value while setting the value for tooltip
 

How do I get AxisLabel value while setting the value for tooltip

Hi Alex,

Ihave acode block to dynamically populate/invoke another graph(aspx) onmouseover-

The chart is working fine, where as while setting the value foe the tooltip the value for

series.Points(pointIndex).AxisLabel

is ""

Here is my code-

myseries.ChartType = SeriesChartType.Column

ds = ObjAdmin_bo.GetBarChartData(txtStDt.Text.ToString, txtEndDt.Text.ToString) 'Date.Today.ToShortDateString.ToString) '

If ds.Tables(0).Rows.Count < 1 Then
pnlErrorMsg.Visible = True
ServerErrorMessage.Text = "No matching records found."
Else
ServerErrorMessage.Text = ""
End If

myseries.Points.DataBindXY(ds.Tables(0).Rows, "LetterCount", ds.Tables(0).Rows, "workdays")
Chart1.Series.Add(myseries)
Chart1.Series(0).IsValueShownAsLabel = True

'Chart1.ChartAreas(0).AxisX.Interval = 1

' Set series tooltips
Dim series As Series
For Each series In Chart1.Series
Dim pointIndex As Integer
For pointIndex = 0 To series.Points.Count - 1
Dim toolTip As String = ""
toolTip = "<IMG SRC=LogsListDetails.aspx?dcnt=" + series.Points(pointIndex).AxisLabel + "&sdt=" + txtStDt.Text.ToString + "&edt=" + txtEndDt.Text.ToString + ">"
series.Points(pointIndex).MapAreaAttributes = "onmouseover=""DisplayTooltip('" + toolTip + "');"" onmouseout=""DisplayTooltip('');"""
'series.Points(pointIndex).Href = "DetailedRegionChart.aspx?region=" + series.Points(pointIndex).AxisLabel
Next pointIndex
Next series



When I debug, the value for series.Points(pointIndex).AxisLabel
is "".

Will appreciate your quick help.
Thanks, Krishna
krishna_001
Alex Gorev
Hi Alex,

Ihave acode block to dynamically populate/invoke another graph(aspx) onmouseover-

The chart is working fine, where as while setting the value foe the tooltip the value for

series.Points(pointIndex).AxisLabel

is ""

Here is my code-

myseries.ChartType = SeriesChartType.Column

ds = ObjAdmin_bo.GetBarChartData(txtStDt.Text.ToString, txtEndDt.Text.ToString) 'Date.Today.ToShortDateString.ToString) '

If ds.Tables(0).Rows.Count < 1 Then
pnlErrorMsg.Visible = True
ServerErrorMessage.Text = "No matching records found."
Else
ServerErrorMessage.Text = ""
End If

myseries.Points.DataBindXY(ds.Tables(0).Rows, "LetterCount", ds.Tables(0).Rows, "workdays")
Chart1.Series.Add(myseries)
Chart1.Series(0).IsValueShownAsLabel = True

'Chart1.ChartAreas(0).AxisX.Interval = 1

' Set series tooltips
Dim series As Series
For Each series In Chart1.Series
Dim pointIndex As Integer
For pointIndex = 0 To series.Points.Count - 1
Dim toolTip As String = ""
toolTip = "<IMG SRC=LogsListDetails.aspx?dcnt=" + series.Points(pointIndex).AxisLabel + "&sdt=" + txtStDt.Text.ToString + "&edt=" + txtEndDt.Text.ToString + ">"
series.Points(pointIndex).MapAreaAttributes = "onmouseover=""DisplayTooltip('" + toolTip + "');"" onmouseout=""DisplayTooltip('');"""
'series.Points(pointIndex).Href = "DetailedRegionChart.aspx?region=" + series.Points(pointIndex).AxisLabel
Next pointIndex
Next series



When I debug, the value for series.Points(pointIndex).AxisLabel
is "".

Will appreciate your quick help.
Thanks, Krishna

I got a work around to the issue by adding a for loop and assigning the AxisLabel values manually.....
For i As Integer = 0 To Chart1.Series(0).Points.Count - 1



            Dim Y_val As String = ds.Tables(0).Rows(i)("LetterCount").ToString()



            Dim X_val As String = ds.Tables(0).Rows(i)("workdays").ToString()



            'Chart1.Series(0).Points(i).ToolTip = "Days=" + X_val + "LCnt=" + Y_val



            Chart1.Series(0).Points(i).ToolTip = X_val



            Chart1.Series(0).Points(i).AxisLabel = X_val.ToString



        Next





Where as in my next code block


Dim series As Series



        For Each series In Chart1.Series



            Dim pointIndex As Integer



            For pointIndex = 0 To series.Points.Count - 1



                Dim toolTip As String = ""



                toolTip = "<IMG SRC=Details.aspx?dcnt=" + series.Points(pointIndex).AxisLabel + "&sdt=" + txtStDt.Text.ToString + "&edt=" + txtEndDt.Text.ToString + ">"



                series.Points(pointIndex).MapAreaAttributes = "onmouseover=""DisplayTooltip('" + toolTip + "');"" onmouseout=""DisplayTooltip('');"""



                series.Points(pointIndex).Href = "LogsListDetails.aspx?dcnt=" + series.Points(pointIndex).AxisLabel + "&sdt=" + txtStDt.Text.ToString + "&edt=" + txtEndDt.Text.ToString







            Next pointIndex



        Next series





it says "Href" is not a member of System.Web.UI...... where as I have taken the code from the Samples environment

and when I comment the line


'series.Points(pointIndex).Href = "Details.aspx?dcnt=" + series.Points(pointIndex).AxisLabel + "&sdt=" + txtStDt.Text.ToString + "&edt=" + txtEndDt.Text.ToString<br/>





I get an script error while debugging at the line(dynamic debug mode) for .aspx


<map name="ctl00_MainContent_Chart1ImageMap" id="ctl00_MainContent_Chart1ImageMap">







	<area shape="rect" coords="691,270,725,328" title="3" onmouseover="DisplayTooltip('&lt;IMG SRC=Details.aspx?dcnt=3&amp;sdt=09/01/2008&amp;edt=10/01/2008>');" onmouseout="DisplayTooltip('');" alt="" />





saying object expected.

Will appreciate any quick help...!!
Thanks, Krishna
  • Proposed As Answer bycodepuller1 Wednesday, April 29, 2009 7:07 PM
  •  
krishna_001
Alex Gorev
Krishna - Take a look at the html in the sample - you might be missing the javascript function of "DisplayTooltip"
codepuller1
I am able to set hyperlinks to data points using the following code from above:

for (int i = 0; i < chart.Series["Series1"].Points.Count; i++)
{
    chart.Series["Series1"].Points[i].Url = "ChartDetailData.aspx?type=" + chart.Series["Series1"].Points[i].AxisLabel;
}

How can I apply the same type of hyperlinks to the legend items? The only example I could find (Interactivity and AJAX > Drill Down > Image Map Selection) uses different series not different points of the same series.
im1dermike

You can use google to search for other answers

Custom Search

More Threads

• Y Data Not Visible in ASP.NET Chart Control Properties inside VS 2008
• Financial Formula
• Data points insertion error. Only 1 Y values can be set for this data series.
• clearing png files / column chart label formatting
• .Net chart change y-axis label from milliseconds to seconds
• error generated in using WinSamples with databinding to csv file
• Getting the exact coordinates of the charting area
• Pie Chart Control
• How to fix margin and padding of chart when dinamic resize occurs
• Integers grouping