Click here to Skip to main content
15,923,120 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using a chart control in an asp.net application. I drew 2 lines high and low by taking y coordinates in series 1 and series 2 but i am getting X And Y value of chart on tooltip. I want the tooltip value or x and y coordinate value in label on mouse move event.

i would like to emulate the functionality of finance.google.com

My code is as follows:

XML
<asp:Chart ID="Chart3" runat="server" DataSourceID="SqlDataSource1"Height="258px"uot;351px">
           <Series>
               <asp:Series ChartType="Line" Name="Series1" XValueMember="date"
                   XValueType="Date" YValueMembers="high" YValueType="Single"
                   ToolTip="#VALY,#VALX" MarkerImageTransparentColor="192, 192, 255"
                   MarkerStyle="Diamond">
                 </asp:Series>
               <asp:Series ChartType="Line" Name="Series2" XValueMember="date"
                   XValueType="Date" YValueMembers="low" YValueType="Single"
                   ToolTip="#VALY,#VALX" MarkerStyle="Diamond">

               </asp:Series>

           </Series>
           <ChartAreas>
               <asp:ChartArea Name="ChartArea1">
                   <AxisX IntervalType="Days">
                       <MajorGrid Enabled="False" />
                       <LabelStyle Interval="Auto" IntervalType="Days" />
                       <ScaleView SizeType="Days" />
                   </AxisX>
                   <AxisY>
                       <MajorGrid Enabled="False" />
                   </AxisY>
               </asp:ChartArea>
           </ChartAreas>
       </asp:Chart>

       <asp:SqlDataSource ID="SqlDataSource1" runat="server"
           ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
           SelectCommand="SELECT * FROM [score]"></asp:SqlDataSource>
Posted
Updated 14-Dec-11 0:37am
v3
Comments
Slacker007 14-Dec-11 6:37am    
Edit: formatting

use this property
LabelToolTip="Volumes(in million)"
or
ToolTip="Volumes(in million)"
in your code



XML
<asp:Series XValueMember="Days" YValueMembers="CashVolumn" ToolTip="Volumes(in million)"
                           IsValueShownAsLabel="true" LabelToolTip="Volumes(in million)" Name="Series1"
                           ChartType="Line" Color="Red" IsVisibleInLegend="true" BorderWidth="2">
                       </asp:Series>
                       <asp:Series Name="Series2" XValueMember="Days" YValueMembers="FTE" ToolTip="No of FTEs"
                           IsValueShownAsLabel="true" LabelToolTip="No of FTEs" ChartType="Line" YAxisType="Secondary"
                           IsVisibleInLegend="true" Color="BlueViolet" BorderWidth="2">
                       </asp:Series>
 
Share this answer
 
v2
X axis is Time and Y axis is Temperature. I need to get the X and Y value when we click on Chart area. I am getting Y axis value , but X axis is showing zero.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900