I have a table (MSFlexgrid1) in a form (frmCalculate) containing 2 columns of Depth and Volume data. I want to draw a line graph of Depth Vs Volume in a new form (frmGraph) by using MSChart control. How can I do this?
You have to define the settings for the chart: (see also attachment) - Private Sub Form_Load()
-
With ChartCalc
-
.chartType = VtChChartType2dXY
-
.Plot.UniformAxis = False
-
With .Plot.Axis(VtChAxisIdX)
-
.AxisTitle.Text = "Volume"
-
.ValueScale.Auto = True '§ Turn on the auto scale
-
.ValueScale.Maximum = ARRAYGRAPH(UBound(ARRAYGRAPH), 1) '§ set the max and min.
-
.ValueScale.Minimum = ARRAYGRAPH(LBound(ARRAYGRAPH), 1)
-
End With
-
With .Plot.Axis(VtChAxisIdY)
-
.AxisTitle.Text = "Depth"
-
.AxisTitle.TextLayout.VertAlignment = VtVerticalAlignmentCenter
-
.AxisTitle.TextLayout.Orientation = VtOrientationUp
-
.ValueScale.Auto = True
-
.ValueScale.Maximum = ARRAYGRAPH(UBound(ARRAYGRAPH), 2)
-
.ValueScale.Minimum = ARRAYGRAPH(LBound(ARRAYGRAPH), 2)
-
End With
-
.ChartData = ARRAYGRAPH
-
End With
-
End Sub
10 14620
Is it: X= depth Y= volume ?
Y| volume
|
|
|
|_________X depth
or vice versa ?
While I search on web about this matter, I found about drawing graph using FusionChart. I have downloaded it an read through its documentation, but I couldn't find on drawing graph by using data from MSFlexgrid. What is exactly the different of drawing the graph by using FusionChart and MSChart controls? Which one is easier to understand and use?
TQ for your help :)
Fusion chart is an application to embed in other applications like java, ... Works with PHP, ASP.NET, JSP, ColdFusion, Python, RoR, simple HTML pages or even PowerPoint Presentations
All the charts can pull data from any database and are AJAX enabled
I think that MSchart is better for Your project because:
- It's standard VB6 and easy to implement in Your program because You only want to show a line and not fancy 3D graphs.
- If You use Fusionchart them the software has to be installed on each computer who wants to run Your program.
Ps: I'm testing MS chart have already results but have to learn how to use it to set titles, axis, ...
How it's work: its very simple: put the data in an array and link the chart with the array.
Attached is what I have for now. (!!! the X axis IS NOT OK !!!!: volume is in the graph to !!!)
I have only to find out how the array must be populated and the graph parameters must be set for an XY graph.
Thank You for the code :)
However there are several things I want to change on the graph. I went through your code but somehow I am not quite clear on how this MSChart works. How did you declare the grid columns to the graph axes respectively? Which line in the code is for this purpose? These are the things on the graph I wish to change:
- There are 2 lines appear on the graph (red and green). The red line represents depth - storage graph. What is the green line represents? How to get rid of it?
- The Volume values in X axis represented by R1, R2, R3,... How to change them to decimal numbers?
- The first point on the graph is (0,0), but somehow it does not lie on the intersection of the X and Y axes, which means the 0 value of X is not in the same point as 0 value of Y. Is it possible to change that?
TQ for your time...
You have to define the settings for the chart: (see also attachment) - Private Sub Form_Load()
-
With ChartCalc
-
.chartType = VtChChartType2dXY
-
.Plot.UniformAxis = False
-
With .Plot.Axis(VtChAxisIdX)
-
.AxisTitle.Text = "Volume"
-
.ValueScale.Auto = True '§ Turn on the auto scale
-
.ValueScale.Maximum = ARRAYGRAPH(UBound(ARRAYGRAPH), 1) '§ set the max and min.
-
.ValueScale.Minimum = ARRAYGRAPH(LBound(ARRAYGRAPH), 1)
-
End With
-
With .Plot.Axis(VtChAxisIdY)
-
.AxisTitle.Text = "Depth"
-
.AxisTitle.TextLayout.VertAlignment = VtVerticalAlignmentCenter
-
.AxisTitle.TextLayout.Orientation = VtOrientationUp
-
.ValueScale.Auto = True
-
.ValueScale.Maximum = ARRAYGRAPH(UBound(ARRAYGRAPH), 2)
-
.ValueScale.Minimum = ARRAYGRAPH(LBound(ARRAYGRAPH), 2)
-
End With
-
.ChartData = ARRAYGRAPH
-
End With
-
End Sub
THANK YOU!!! That works so well! Now I know how to use MSChart control. Thanks to YOU! :)
Opps... There's one more thing. If the depth start with negative numbers, e.g., -5.000, the X axis values will appear on the middle of the chart grid (see attachment). can we make it be at the bottom of the grid no matter what value of the first depth is?
Just add in the code the settings for ".intersection" => - With .Plot.Axis(VtChAxisIdX)
-
.AxisTitle.Text = "Volume"
-
.ValueScale.Auto = True '§ Turn on the auto scale
-
.ValueScale.Maximum = ARRAYGRAPH(UBound(ARRAYGRAPH), 1) '§ set the max and min.
-
.ValueScale.Minimum = ARRAYGRAPH(LBound(ARRAYGRAPH), 1)
-
.Intersection.Auto = False
-
.Intersection.LabelsInsidePlot = False
-
End With
Sign in to post your reply or Sign up for a free account.
Similar topics
by: RichMo |
last post by:
Hi,
I'm new to C++ and i can't seem to find a tutorial on the net for this
one.
I have a dialog based MFC app running that reads sensors using a USB
interface device.
At the moment the...
|
by: mike11d11 |
last post by:
I tried using the windows winsocket control on my Access form and place
the recieved data in a text box. I got it to work but the data is
coming accross like ÿþ%ÿý and I cant use that...
|
by: debasisdas |
last post by:
Hi i am using MSCHART control in VB6 to create some interactive chart.
It works fine ,but my problem is every time i frame the query dynamically as per user interaction it skips the first record...
|
by: j2flk1234 |
last post by:
Hi,
I have a user entering information into a MSFlexGrid and want to graph some of the data using a line graph. I tried using MSChart but it doesn't seem to work for me. Does anyone have any...
|
by: debasisdas |
last post by:
Here's a simple VB6 code snippet that uses the MSChart control to display Charts in VB6.0.
To use this sample, please following steps
Create a new project in VB6
Pull down the Project menu and...
|
by: shweta goel |
last post by:
Anyone can tell me : how to draw pie chart using MSChart control having data from 2 or 3 variables.
|
by: mani.shanku |
last post by:
hi friendsplz..help me its urgent.....
im making a jobportal site..when a person go for search the results
should desplay....
like the naukri.com desplays..and when a person click on the checkbox...
|
by: buddyr |
last post by:
Hello,
I have form in C#.
I want to use the errorprovider control to prompt user for data if nothing is entered.
example:
I have textbox1 for user to enter name.
I have radiobuttons for job...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |