[英]How can I set the x-axis (or y-axis) value of an asp chart using javascript
I have a simple asp chart 我有一个简单的asp图表
<asp:Chart ID="chtRISKSCORE" runat="server" Width="450px" BackColor="#1E1E1E" Height="400px">
<Titles>
<asp:Title ForeColor="White" Text="Risk Score" Font="Tahoma, 12pt"/>
</Titles>
<BorderSkin PageColor="Transparent" BackColor="Transparent" BackHatchStyle="None" />
<Series>
<asp:Series Name="Categories" ChartType="Column Palette="EarthTones" ChartArea="MainChartArea" LabelForeColor="White" LabelBackColor="White"></asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="MainChartArea" BackColor="Transparent" Area3DStyle-Enable3D="false">
<Area3DStyle Enable3D="false"></Area3DStyle>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
What I'd like to do is allow the user to set where a point crosses (ie set an x and ay value). 我想做的是允许用户设置点的交叉点(即设置x和ay值)。 I have two sliders that will eventually (with your help) set the x and y value of the point on the chart. 我有两个滑块,最终将在您的帮助下设置图表上该点的x和y值。
Any Javascript examples would be perfect. 任何Javascript示例都是完美的。 I can't seem to find anything on this issue so far. 到目前为止,我似乎找不到任何关于此问题的信息。
I've started with this but now I'm stuck. 我已经开始了,但是现在我陷入了困境。 So I add an 'onValueChanged' event to a slider. 因此,我向滑块添加了“ onValueChanged”事件。 I've then located the asp chart but how can I set the x(or y)-axis value? 然后,我找到了asp图表,但是如何设置x(或y)轴值?
function pageLoad(sender, e) {
var slider = $find("<%=sleNEWSCOREIMPACTSLIDER.ClientID%>");
slider.add_valueChanged(onValueChanged);
}
function onValueChanged(sender, e) {
var slider = $find("<%=sleNEWSCOREIMPACTSLIDER.ClientID%>");
var slidervalue = slider.value;
var chart = $find("<%=chtRISKSCORE.ClientID%>");
var series = chart.options.series;
}
You can not modify the chart at client side using the JavaScript. 您无法使用JavaScript在客户端修改图表。 The chart is an image generated at server. 图表是在服务器上生成的图像。 So after sliding you need to go back to the server and generate the chart again as per sliding value. 因此,滑动后,您需要返回服务器并根据滑动值再次生成图表。 If you want a chart that interacts with user input at client side and can be controlled with simple JavaScript and jquery then you need to use jquery graphs like jqplot etc. 如果您希望图表与客户端的用户输入进行交互并且可以通过简单的JavaScript和jquery进行控制,则需要使用jqplot等jquery图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.