开发者

Making a good XY (scatter) chart in VB6

开发者 https://www.devze.com 2023-02-12 10:56 出处:网络
I need to write an application in VB6 which makes a scatter plot out of a series of data points. The current workflow:

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 l开发者_StackOverflow中文版ike. (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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号