DataGridView的用户交互式图形 [英] User interactive Graph from DataGridView
问题描述
我的目的是创建图表,以便将Gridview中的信息显示到图表。然后,用户可以选择图表上的点,然后从数据的该部分显示具体的信息,例如一行。
我不确定要使用哪个API:
我已经尝试使用内部图表功能进行视觉Studio,但我无法将可选部分与我创建的图形交互。
如果任何人有任何建议,如何做到这将是巨大的。
您的问题似乎有几个部分。我会尝试帮助每个..
您的问题的最后一部分解决如下:
假设你有与所述数据点集和表示线图表中,可以使用这样的:
系列S = chart1.Series [0]; // short reference
S.ToolTip =#VALX {#。##}+:+#VALY1 {#。##};
以您喜欢的格式显示x和y值作为工具提示。
'p>请参阅 MSDN关于用于引用DataPoint的关键字的完整列表
如果要显示不属于的数据,数据点
的数据,则可以改为创建单独的工具提示
每个数据点
如果你把:
double dx = yourXValue;
double dy = yourYValue;
DataPoint dp = new DataPoint(dx,dy);
dp.ToolTip = yourToolTip;
S.Points.Add(dp);
您将不得不轻松创建 ToolTip
格式化为每个 DataPoint
!
如果其他部分仍然打开,请说出来!
I have a DataGridView that displays information that is read from a txt file. My aim is to create a line graph for this data which displays DateTime for the X axis.
My aim is to create the graph so it shows the information from the Gridview onto the graph. The user can then select points on the graph that then show them specific info from that part of the data for example a row.
I am not sure which API to use for this:
I have tried using internal Chart functions for Visual Studio but I can not interact the selectable part onto the graphs I created.
If anyone has any advice on how to do this would be great.
Your question seems to have several parts. I'll try to help with each..
The last part in your question is solved like this:
Assuming you have a Chart with the DataPoints set and showing the line, you can use this:
Series S = chart1.Series[0]; // short reference
S.ToolTip = "#VALX{#.##}" + " : " + "#VALY1{#.##}";
to display the x- and y-values as tooltips in a format you like.
See MSDN for a full list of keywords to use in referring to the DataPoints
If you want to display data that are not part of the DataPoint
's data you can instead create individual ToolTips
for each DataPoint
when you add it:
double dx = yourXValue;
double dy = yourYValue;
DataPoint dp = new DataPoint(dx, dy);
dp.ToolTip = yourToolTip;
S.Points.Add(dp);
You will have to create the ToolTip
readily formatted for each DataPoint
!
If other parts are still open, please say so!
这篇关于DataGridView的用户交互式图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!