在 VB6 中制作良好的 XY(散点)图
我需要用 VB6 编写一个应用程序,它可以根据一系列数据点绘制散点图。
当前工作流程:
- 用户输入信息。
- 一堆计算下来。
- 输出数据显示在一系列 10 个列表框中。
- 每次单击“计算”按钮时,都会在列表框中输入 2 到 9 个条目。
- 一个列表框包含 x 坐标。
- 一个列表框包含 y 坐标。
我需要:
- 浏览这些列表框,然后选择我的 x 和 y。
- 另一个列表框字段会不时变化,在 0 到 100 之间变化,该字段需要区分最终图表上 x 和 y 属于哪个系列。因此,我将拥有具有六个 (x,y) 数据点的系列 1、具有六个数据点的系列 26、具有六个数据点的系列 99,等等或八个数据点。或者两个数据点。用户控制有多少个 x。
- 理想情况下,我将有一个包含多个系列的图表来显示所有这些信息。
我不允许使用第三方解决方案(例如 Excel)。这一切都必须包含在 VB6 应用程序中。
我目前正在尝试使用 MS Chart 来做到这一点,因为似乎有最多的文档。然而,这似乎集中在饼图和其他不相关的可视化上。
我完全愿意使用 MS Graph,但我不了解该工具,也找不到好的文档。
我认为二维数组是不行的,因为它需要不断动态变化的大小,而这是不可能做到的(或者有人告诉我)。理想情况下,我会剔除运行,按第三个系列参数对数据进行排序,然后插入 x 和 y,但我发现 MS Chart 的命令和结构非常密集,我只是在其中运行非常小的圆圈。
编辑:如果您可以直观地看到我的数据是什么样子,这可能会有所帮助。 (S 代表系列,组成数字。)
SX Y
1 0 1000000
1 2 500000
1 4 250000
1 6 100000
2 0 1000000
2 2 6500
2 4 5444
2 6 1111
I need to write an application in VB6 which makes a scatter plot out of a series of data points.
The current workflow:
- User inputs info.
- A bunch of calculations go down.
- The output data is displayed in a series of 10 list boxes.
- Each time the "calculate" button is clicked, 2 to 9 entries are entered into the list boxes.
- One list box contains x coordinates.
- One list box contains the y coordinates.
I need to:
- Scan through those list boxes, and select my x's and y's.
- Another list box field will change from time to time, varying between 0 and 100, and that field is what needs to differentiate which series on the eventual graph the x's and y's go into. So I will have Series 1 with six (x,y) data points, Series 26 with six data points, Series 99 with six data points, etc. Or eight data points. Or two data points. The user controls how many x's there are.
- Ideally, I'll have a graph with multiple series displaying all this info.
I am not allowed to use a 3rd party solution (e.g. Excel). This all has to be contained in a VB6 application.
I'm currently trying to do this with MS Chart, as there seems to be the most documentation for that. However, this seems to focus on pie charts and other unrelated visualizations.
I'm totally open to using MS Graph but I don't know the tool and can't find good documentation.
A 2D array is, I think, a no go, since it would need to be of a constantly dynamically changing size, and that can't be done (or so I've been told). I would ideally cull through the runs, sort the data by that third series parameter, and then plug in the x's and y's, but I'm finding the commands and structure for MS Chart to be so dense that I'm just running around in very small circles.
Edit: It would probably help if you can visualize what my data looks like. (S for series, made up numbers.)
S X Y
1 0 1000000
1 2 500000
1 4 250000
1 6 100000
2 0 1000000
2 2 6500
2 4 5444
2 6 1111
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道 MSGraph,但我确信 VB6 中有某种画布元素,您可以使用它来轻松地自己绘制点。散点图是一种易于您自己制作的图表,只要您不需要计算最佳拟合线即可。
如果您找不到适合您的工具,我建议您研究一下画布元素并手动完成。
I don't know MSGraph, but I'm sure there is some sort of canvas element in VB6 which you can use to easily draw dots yourself. Scatter plots are an easy graph to make on your own, so long as you don't need to calculate a line of best fit.
I would suggest looking into the canvas element and doing it by hand if you can't find a tool that does it for you.
结论:MSChart 和 MSGraph 都可以发挥作用。我辛苦了又辛苦,却从这两件事中都一无所获。我知道他们可以做散点图,但我确实不能让他们做得很好。
@黑熊!在发现我的前任也有同样的问题并且只是使用 Pset 和 Line 制作了一些非常令人印象深刻的图表后,我做了同样的事情 - 即使它在未来不能像预期的那样可重现和通用。可行的解决方案,尽管功能较少>>>具有强大功能的解决方案只存在于神话中。
如果有人正在阅读本文并有关于散点图和 MSChart/Graph 的实际答案,我仍然很想知道。
Conclusion: MSChart and MSGraph can both go suck a lemon. I toiled and toiled and got a whole pile of nothing out of either one. I know they can do scatter plots, but I sure as heck can't make them do 'em well.
@BlackBear! After finding out that my predecessor had the same problems and just used Pset and Line to make some really impressive graphs, I did the same thing - even if it's not reproducible and generic in the future as was desired. The solution that works, albeit less functionally >> the solution with great functionality that exists only in myth.
If anyone is reading this down the line and has an actual answer about scatter plots and MSChart/Graph, I'd still love to know.