简体   繁体   English

在 VB6 中制作一个好的 XY(散点)图

[英]Making a good XY (scatter) chart in VB6

I need to write an application in VB6 which makes a scatter plot out of a series of data points.我需要在 VB6 中编写一个应用程序,它可以根据一系列数据点制作散点图。

The current workflow:当前工作流程:

  • User inputs info.用户输入信息。
  • A bunch of calculations go down.一堆计算下来。
  • The output data is displayed in a series of 10 list boxes.输出数据显示在一系列 10 个列表框中。
  • Each time the "calculate" button is clicked, 2 to 9 entries are entered into the list boxes.每次单击“计算”按钮时,列表框中都会输入 2 到 9 个条目。
  • One list box contains x coordinates.一个列表框包含 x 坐标。
  • One list box contains the y coordinates.一个列表框包含 y 坐标。

I need to:我需要:

  • Scan through those list boxes, and select my x's and y's.浏览这些列表框,然后选择我的 x 和 y。
  • 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.另一个列表框字段会不时更改,在 0 和 100 之间变化,该字段用于区分 x 和 y 进入最终图形上的哪个系列。 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.所以我将有带有六个 (x,y) 数据点的系列 1、带有六个数据点的系列 26、带有六个数据点的系列 99,等等。或者八个数据点。 Or two data points.或两个数据点。 The user controls how many x's there are.用户控制 x 的数量。
  • Ideally, I'll have a graph with multiple series displaying all this info.理想情况下,我将有一个包含多个系列的图表来显示所有这些信息。

I am not allowed to use a 3rd party solution (eg Excel).我不允许使用第 3 方解决方案(例如 Excel)。 This all has to be contained in a VB6 application.这一切都必须包含在 VB6 应用程序中。

I'm currently trying to do this with MS Chart, as there seems to be the most documentation for that.我目前正在尝试使用 MS Chart 来执行此操作,因为这方面的文档似乎最多。 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.我完全愿意使用 MS Graph,但我不知道该工具,也找不到好的文档。

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.理想情况下,我会剔除运行,按第三个系列参数对数据进行排序,然后插入 x 和 y,但我发现 MS 图表的命令和结构非常密集,以至于我只是在里面跑来跑去非常小的圆圈。


Edit: It would probably help if you can visualize what my data looks like.编辑:如果您可以可视化我的数据是什么样子,这可能会有所帮助。 (S for series, made up numbers.) (S 代表系列,组成数字。)

SXY SXY
1 0 1000000 1 0 1000000
1 2 500000 1 2 500000
1 4 250000 1 4 250000
1 6 100000 1 6 100000

2 0 1000000 2 0 1000000
2 2 6500 2 2 6500
2 4 5444 2 4 5444
2 6 1111 2 6 1111

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.我不知道 MSGraph,但我确信 VB6 中有某种画布元素,您可以使用它来轻松地自己绘制点。 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.如果您找不到适合您的工具,我建议您查看 canvas 元素并手动完成。

Conclusion: MSChart and MSGraph can both go suck a lemon.结论:MSChart 和 MSGraph 都可以吃一个柠檬。 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.在发现我的前任有同样的问题并且只是使用 Pset 和 Line 制作了一些非常令人印象深刻的图表后,我做了同样的事情——即使它在未来不能像预期的那样重现和通用。 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.如果有人正在阅读这篇文章并有关于散点图和 MSChart/Graph 的实际答案,我仍然很想知道。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM