获取图表的X和Y轴坐标 [英] Obtaining a chart's X and Y axis coordinates

查看:96
本文介绍了获取图表的X和Y轴坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net应用程序中使用图表控件.我通过在系列1和系列2中获取y坐标来绘制上下两行,但是我在工具提示上获得了图表的X和Y值.我需要鼠标移动事件时标签中的工具提示值或x和y坐标值.

我想模仿finance.google.com
的功能
我的代码如下:

 <   asp:图表    ID   ="   ="span>    runat   =" 服务器"  DataSourceID    SqlDataSource1"  = "   uot; 351px" <  系列 > 
               <   asp:Series     ChartType   ="  名称   Series1 "  XValueMember   日期" 
                                      ="  日期"  YValueMembers   ="     YValueType   ="  
                                      ="  #VALY,#VALX"  MarkerImageTransparentColor   ="  
                   span>                    ="  钻石" <  /asp:Series  > 
               <   asp:Series     ChartType   ="  名称   Series2 "  XValueMember   日期" 
                                      ="  日期"  YValueMembers   ="     YValueType   ="  
                                      ="  #VALY,#VALX"  MarkerStyle   ="  > 

               <  /asp:Series  > 

           <  /Series  > 
           <   ChartAreas  > 
               <   asp:ChartArea    名称  ="  <   AxisX     ="   Days" <   MajorGrid     ="   False" / <   LabelStyle     ="  自动"  IntervalType   天数"   / > 
                       <   ScaleView     ="   Days" / <  /AxisX  > 
                   <   AxisY  > 
                       <   MajorGrid     ="   False" / <  /AxisY  > 
               <  /asp:ChartArea  > 
           <  /ChartAreas  > 
       <  /asp:图表 > 

       <   asp:SqlDataSource     ID   ="   runat   服务器" 
                          ConnectionString    <% $ ConnectionStrings:ConnectionString %> " 
                          SelectCommand    SELECT * FROM [score]" <  >  

%> " SelectCommand SELECT * FROM [score]" < >


使用此属性

LabelToolTip="Volumes(in million)"

在您的代码中



 <   asp:Series     XValueMember   ="  span>    YValueMembers   =" 现金量"  ToolTip   数量(百万)" 
                     span>                                  IsValueShownAsLabel   ="     LabelToolTip   ="    名称   Series1" 
                     span>                                  ChartType   ="    颜色  ="   IsVisibleInLegend       BorderWidth   ="  >> 
                       <  /asp:Series  > 
                       <   asp:Series    名称  ="   XValueMember   天数"  YValueMembers    FTE"  ToolTip    FTE数量" 
                     span>                                  IsValueShownAsLabel   ="     LabelToolTip   ="   ChartType   行"  YAxisType   ="  
                     span>                                  IsVisibleInLegend   ="    颜色  ="   BorderWidth    > 
                       <  /asp:Series  >  


X轴是时间,Y轴是温度.当我们单击图表"区域时,我需要获取X和Y值.我得到Y轴值,但X轴显示零.


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:

<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>

解决方案

ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [score]"></asp:SqlDataSource>


use this property

LabelToolTip="Volumes(in million)"

or

ToolTip="Volumes(in million)"

in your code



<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>


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.


这篇关于获取图表的X和Y轴坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆