Creating a chart in Excel using VC++ .net 2005

A

antarikshv

Hi,
Can any one please help me in creating chart in VC++ .net 2005 and
Excel 2003.
I am stuck at the point when i want to give a specific column as the X-
axis and a specific column as Y-axis. currently i am able to specify a
range and draw the chart. If you could give the code then it will be
the best thing. the following is the code i am referring to.

// The following code draws the chart
Excel::ChartObjects^ chartobjects =
safe_cast<Excel::ChartObjects^>(worksheet->ChartObjects(oMissing));

Excel::ChartObject^ chartobject =
safe_cast<Excel::ChartObject^>(chartobjects->Add(10 /*Left*/, 100 /
*Top*/, 450 /*Width*/, 250 /*Height*/));
Excel::_Chart^ chart = safe_cast said:


// Call to chart.ChartWizard() is shown using late binding
technique solely for the demonstration purposes
array<Object^>^ args7 = gcnew array<Object^>(11);
args7[0] = ran; // Source
args7[1] = Excel::XlChartType::xlLineMarkers; // Gallery - note,
we're using implicit boxing here
args7[2] = oMissing; // Format
args7[3] = Excel::XlRowCol::xlRows; // PlotBy - note, we're using
implicit boxing here
args7[4] = nullptr; // CategoryLabels
args7[5] = nullptr; // SeriesLabels
args7[6] = true; // HasLegend - note, we're using implicit boxing
here
args7[7] = "Sample Chart"; // Title
args7[8] = "Sample Category Type"; // CategoryTitle
args7[9] = "Sample Value Type"; // ValueTitle
args7[10] = oMissing; // ExtraTitle
// The last parameter is lcid, but as we use late binding here it
should be omited
//args7[11] = 0; // lcid
chart->GetType()->InvokeMember("ChartWizard",
System::Reflection::BindingFlags::InvokeMethod, nullptr, chart,
args7);


Also i am unaware of late bindings. Can anyone help with what it means
and what effect does it have on performance.
 
A

Alvin Bruney [MVP]

you can find code to build a chart in C# at the
office.developer.web.components newsgroup. You'll then need to do some
translation

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless Author Plug
OWC Black Book 2nd Edition
Exclusively on www.lulu.com/owc
$24.99


antarikshv said:
Hi,
Can any one please help me in creating chart in VC++ .net 2005 and
Excel 2003.
I am stuck at the point when i want to give a specific column as the X-
axis and a specific column as Y-axis. currently i am able to specify a
range and draw the chart. If you could give the code then it will be
the best thing. the following is the code i am referring to.

// The following code draws the chart
Excel::ChartObjects^ chartobjects =
safe_cast<Excel::ChartObjects^>(worksheet->ChartObjects(oMissing));

Excel::ChartObject^ chartobject =
safe_cast<Excel::ChartObject^>(chartobjects->Add(10 /*Left*/, 100 /
*Top*/, 450 /*Width*/, 250 /*Height*/));
Excel::_Chart^ chart = safe_cast said:


// Call to chart.ChartWizard() is shown using late binding
technique solely for the demonstration purposes
array<Object^>^ args7 = gcnew array<Object^>(11);
args7[0] = ran; // Source
args7[1] = Excel::XlChartType::xlLineMarkers; // Gallery - note,
we're using implicit boxing here
args7[2] = oMissing; // Format
args7[3] = Excel::XlRowCol::xlRows; // PlotBy - note, we're using
implicit boxing here
args7[4] = nullptr; // CategoryLabels
args7[5] = nullptr; // SeriesLabels
args7[6] = true; // HasLegend - note, we're using implicit boxing
here
args7[7] = "Sample Chart"; // Title
args7[8] = "Sample Category Type"; // CategoryTitle
args7[9] = "Sample Value Type"; // ValueTitle
args7[10] = oMissing; // ExtraTitle
// The last parameter is lcid, but as we use late binding here it
should be omited
//args7[11] = 0; // lcid
chart->GetType()->InvokeMember("ChartWizard",
System::Reflection::BindingFlags::InvokeMethod, nullptr, chart,
args7);


Also i am unaware of late bindings. Can anyone help with what it means
and what effect does it have on performance.
 
A

antarikshv

you can find code to build a chart in C# at the
office.developer.web.components newsgroup. You'll then need to do some
translation
Hi, Can please give me some link for it? currently i am not able to
find the reference. Please help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top