473,799 Members | 3,267 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drawing line graph using MSChart control using data from MSFlexgrid

Mas Juliza Alias
67 New Member
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?
Dec 28 '10 #1
10 14716
Guido Geurs
767 Recognized Expert Contributor
Is it: X= depth Y= volume ?
Y| volume
|
|
|
|_________X depth

or vice versa ?
Dec 28 '10 #2
Mas Juliza Alias
67 New Member
Y = Depth
X = Volume
Dec 29 '10 #3
Mas Juliza Alias
67 New Member
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 :)
Dec 30 '10 #4
Guido Geurs
767 Recognized Expert Contributor
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.
Attached Files
File Type: zip Drawing line graph using MSChart_v1.1.zip (53.5 KB, 1319 views)
Dec 30 '10 #5
Mas Juliza Alias
67 New Member
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...
Jan 4 '11 #6
Guido Geurs
767 Recognized Expert Contributor
You have to define the settings for the chart: (see also attachment)

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.    With ChartCalc
  3.       .chartType = VtChChartType2dXY
  4.       .Plot.UniformAxis = False
  5.       With .Plot.Axis(VtChAxisIdX)
  6.          .AxisTitle.Text = "Volume"
  7.          .ValueScale.Auto = True '§ Turn on the auto scale
  8.          .ValueScale.Maximum = ARRAYGRAPH(UBound(ARRAYGRAPH), 1) '§ set the max and min.
  9.          .ValueScale.Minimum = ARRAYGRAPH(LBound(ARRAYGRAPH), 1)
  10.       End With
  11.       With .Plot.Axis(VtChAxisIdY)
  12.          .AxisTitle.Text = "Depth"
  13.          .AxisTitle.TextLayout.VertAlignment = VtVerticalAlignmentCenter
  14.          .AxisTitle.TextLayout.Orientation = VtOrientationUp
  15.          .ValueScale.Auto = True
  16.          .ValueScale.Maximum = ARRAYGRAPH(UBound(ARRAYGRAPH), 2)
  17.          .ValueScale.Minimum = ARRAYGRAPH(LBound(ARRAYGRAPH), 2)
  18.       End With
  19.       .ChartData = ARRAYGRAPH
  20.    End With
  21. End Sub
Attached Files
File Type: zip Drawing line graph using MSChart_v1.4.zip (23.8 KB, 929 views)
Jan 5 '11 #7
Mas Juliza Alias
67 New Member
THANK YOU!!! That works so well! Now I know how to use MSChart control. Thanks to YOU! :)
Jan 6 '11 #8
Mas Juliza Alias
67 New Member
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?
Attached Images
File Type: jpg graph.jpg (53.1 KB, 5911 views)
Jan 6 '11 #9
Guido Geurs
767 Recognized Expert Contributor
Just add in the code the settings for ".intersect ion" =>

Expand|Select|Wrap|Line Numbers
  1.       With .Plot.Axis(VtChAxisIdX)
  2.          .AxisTitle.Text = "Volume"
  3.          .ValueScale.Auto = True '§ Turn on the auto scale
  4.          .ValueScale.Maximum = ARRAYGRAPH(UBound(ARRAYGRAPH), 1) '§ set the max and min.
  5.          .ValueScale.Minimum = ARRAYGRAPH(LBound(ARRAYGRAPH), 1)
  6.          .Intersection.Auto = False
  7.          .Intersection.LabelsInsidePlot = False
  8.       End With
Jan 6 '11 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1445
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 varying data just moves a progress bar up and down. I'm looking for a way to display this sensor data as a graph on the
2
3430
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 information. Is there a way to descramble this. I'm thinking it might have to do with using some sort of emulation that can read the info. We have software right now that connects to our server with VT101 emulation. If this is what is making it readable...
1
1730
debasisdas
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 from the recordset. I am using Oracle 9i as my database. anyone can help me please.........
5
4627
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 other suggestions? Thanks in advance.
0
51229
debasisdas
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 choose Components . Select the checkbox next to Microsoft ChartControl 6.0(OLEDB), Click OK. Add a combobox,one Mschart control and one check box tothe existing form. Paste in the following code tothe code window Private Sub Form_Load() 'Fill the...
1
2051
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.
1
1642
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 box link... it is navigating to another window.. ......my problem is .i added a checkbox control to gridview but i can't able to make navigation when he clicks on that checkbox plz..help me...
2
2297
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 departments. I click a button and data displays in labels. label1.text = textbox1; if (radiobutton1.clicked)
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10243
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7570
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.