Link to home
Start Free TrialLog in
Avatar of tszwang
tszwang

asked on

MSChart sample

I am trying to use the MSChart control in my VC project. It is difficult for me to start as there are no sample source code in the help file. May I know anyone out there can give me a sample of how to plot a line graph with two series of data? For example, I have income and expense for a company for years 1997, 1998, 1999. I would like to have two lines on the graph, one showing the income and the other line show the expense.
Thank you very much for your help in advance. :) Cheers!
Avatar of Toronado
Toronado

Hi tszwang,

Do you have problems inserting the MSChart control in your project, or with using the control?

Regards,
 Toronado
Avatar of tszwang

ASKER

I have problem using it. Can you help me? :)
Avatar of tszwang

ASKER

Adjusted points to 200
ASKER CERTIFIED SOLUTION
Avatar of V_Bapat
V_Bapat
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi
Suppose you have added the chart control to CFormView. In OnInitialUpdate() add the following:

m_chart.SetColumnCount(3);  // No of columns
m_chart.SetRowCount(2);     // No of rows

This will give you a chart with 3 columns and 2 rows. To set data first select row and column and then set data. For example,

m_chart.SetColumn(1);
m_chart.SetRow(1);
m_chart.SetData("20");  // R1C1 = 20

m_chart.SetColumn(2);
m_chart.SetRow(2);
m_chart.SetData("40");  // R2C2 = 40

m_chart.SetColumn(3);
m_chart.SetRow(1);
m_chart.SetData("60");  // R1C3 = 60