|
|
Comments and Discussions
|
|
 |

|
Dear Alex,
That is a good article. I am using VC++ and I want to use this control. Could you please to give me more sample about this control (pie chart, bar chart). Or do you know any link concerned?
Thanks
あんかた
|
|
|
|

|
Hi friends,
Has anybody done it in C#
i want this chart controls example in c#
any kind of help is appreciable
thanks in advance
irfan kothari
"Take Care Not Chances"
|
|
|
|

|
If I want to do it in C# I prefer using ZedGraph
http://www.codeproject.com/KB/graphics/zedgraph.aspx
|
|
|
|

|
x-Axis's range are 0 ~ 100.
y-Axis's range are 0 ~ 300.
I wnat to add only one vertical grid line at x=25 in the plot
It must parallel line for y-Axis.
How can I code?
-- modified at 2:00 Wednesday 29th November, 2006
|
|
|
|

|
I have used the ms chart control and it is perfectly working in a VC++ installed machine (XP). But when i take the executable to another machine where VC++ is not installed it doesnt work! I have MSCHRT20.OCX copied to system folder. What else i require? Any help is appreciated
|
|
|
|

|
I'm having the same problem, you need to "regsvr32 mschrt20.ocx" to register the control.
But it appears this is not enough, I'm trying to break my head to make it work, will let you know if I find it
|
|
|
|

|
okay, solved it
1) copy mschrt20.ocx to your Release\Debug folder. You have to deploy this along with your executables, add it as part of your executables.
2) In PostBuild setup or somewhere else register the chart control (regsvr32 mschrt20.ocx)
3) You need a license key for registering the ActiveX control (see MSDN on why you need license key)
4) Run M$ Licence Key REquester to get license key for MSChart (http://support.microsoft.com/kb/151771)
5) Hard-code your license key in your file.
6) convert the WCHAR to BSTR as explained in the MSDN article
7) Create your MSChart control passing the license key:
so code will look something like this:
WCHAR pwchLicenseKey[] =
{
0x0038, 0x0045, 0x0031, 0x0034, 0x0037, 0x0043,
0x0036, 0x0039, 0x002D, 0x0042, 0x0044, 0x0035,
0x0030, 0x002D, 0x0031, 0x0031, 0x0064, 0x0031,
0x002D, 0x0042, 0x0031, 0x0033, 0x0037, 0x002D,
0x0030, 0x0030, 0x0030, 0x0030, 0x0046, 0x0038,
0x0037, 0x0035, 0x0033, 0x0046, 0x0035, 0x0044,
};
BSTR bstrLicenseKey = ::SysAllocStringLen(pwchLicenseKey,
sizeof(pwchLicenseKey)/sizeof(WCHAR));
m_Chart.CreateControl(
m_Chart.GetClsid(), //REFCLSID clsid,
_T("MSChart20Lib.MSChart.2"), // LPCTSTR pszWindowName,
WS_DISABLED, // DWORD dwStyle,
CRect(0,0,100,100), // const RECT& rect
this, // CWnd* pParentWnd
IDC_MY_CHART_CTRL_ID, // UINT nID
NULL, // CFile* pPersist = NULL,
FALSE, // BOOL bStorage = FALSE,
bstrLicenseKey ); // BSTR bstrLicKey = NULL
::SysFreeString(bstrLicenseKey);
8) presto, it works
|
|
|
|

|
Is it MSChart control have the maximum value to display? I have a chart control which display data from a date to a date from selection of date time picker... if my selection in a short period the mschart work well but the date period too long it appear a application error "Debug Assertion Failed"
so i wonder is it there got a maximum value on that or something wrong with my program...
Please advice!!
|
|
|
|

|
If you use SetColumnCount(10) and one of the data for a particular row is say 12, it crashes. Do not set RowCount or ColumnCount if that's your problem
|
|
|
|

|
have been working with the Active X MSCharting class for about a week or so and I have come up with the issue of putting custom labels within the chart. I am using Microsoft Visual Studio 6.0 on Windows 2000 SP4. So far this is what I have found....
CVcSeriesCollection sc = m_chart.GetPlot().GetSeriesCollection();
CVcSeries s = sc.GetItem(2);
CVcDataPoints dps = s.GetDataPoints();
CVcDataPoint dp = dps.GetItem(-1);
dp.GetDataPointLabel().SetLocationType(1);
This works perfectly for displaying the values of all the datapoints above the bars in a selected series.
Now the Problem
I would like to put a custom label on top a datapoint like "8 hours". I have tried the following but get an error when calling dps.GetItem(1);
CVcSeriesCollection sc = m_chart.GetPlot().GetSeriesCollection();
CVcSeries s = sc.GetItem(2);
CVcDataPoints dps = s.GetDataPoints();
long l_Item_Count = dps.GetCount();
CVcDataPoint dp = dps.GetItem(1);
dp.GetDataPointLabel().SetLocationType(1);
dp.GetDataPointLabel().SetText("8 Hours");
Other Information
- There is a dp.GetDataPointLabel().SetCustom(bool) function but I have no idea how to use it. I can set this function to true after calling dps.GetItem(-1) but it seems to do nothing.
- The error that I get says "Index given is out of bounds" but the value that gets stored into l_Item_count is 5.
- This is how I am adding data to the chart. m_chart.GetDataGrid().SetData(ROW_NUM,COL_NUM,d_va lue,0); which I am pretty sure is correct.
- This is what is in my Visual Studios Output box after the exception is thrown..."First-chance exception in Testd.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception. Warning: Uncaught exception in WindowProc (returning 1)."
- I am not adding or modifing the columns or rows in the bar chart at all. I am just using the 5 generic rows and 4 generic columns built by the chart class.
- I can change the labels with the following function: m_chart.GetDataGrid().SetRowLabel(ROW_NUM,1,"RowA" );. The 1 is an index which does something but I dont know what. I have tried to set this value to 2 and 3 but I get errors. This may play a part in this problem I dont really know.
Thanks for taking the time to read my problem. Please responed with any information.
Thanks again.
Chris
|
|
|
|

|
How can I add the row value over or above the bar/colum?
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|

|
Yes you can add the row value over the bars try this...
CVcSeriesCollection sc = m_chart.GetPlot().GetSeriesCollection();
CVcSeries s = sc.GetItem(2); CVcDataPoints dps = s.GetDataPoints();
long here = dps.GetCount();
CVcDataPoint dp = dps.GetItem(-1); dp.GetDataPointLabel().SetLocationType(1);
Chris
|
|
|
|

|
I'm working with MSChart to build a column/bar chart and I want to change programatically the colors of each column. How can I do that?
I've tried to do it by changing the color of the pen but it doesn't change at all:
m_msChart.GetPlot().GetSeriesCollection().GetItem(1).GetPen().GetVtColor().Set(0, 255, 0);
What's wrong or what method do I have to use?
Thanks,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|

|
Oops! I finally found it by myself. If someone else needed is:
m_msChart.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(0, 0, 255);
Bye,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|

|
Try calling the following before attempting to change the series color.
m_chart.GetPlot().GetBackdrop().GetFill().SetStyle(1);
Chris
|
|
|
|

|
hello,
I also want to know the solution for flickering of chart when chart is refreshed.(this is not in reference to my query about dialog application coz for this i just changed the data in the demo proj only)
thanks
sayup
|
|
|
|

|
hello,
I have been trying to use the activex control.I created a simple dialog base application and i want to use the activex controls in my application.what is the exact procedure?do we first have to include the resource file of the controland then declare the ID of the resource file in our dialog application?
please reply urgently
I need the stepe wise procedure to include the controlin my dialog application
thanks
sayup
|
|
|
|

|
Hi All,
I am starting to use the MS chart control in C++ for displaying a x-y plotter graph. But i am not able to figure out how to display a set of 32(x,y) values which range from 0-360 degrees. Could you please help me out? Also is there any help for using mschart in vc++?
Awaiting your reply.
Thanks,
Krishna.
|
|
|
|

|
How import Ms Chart to my project?
ss
|
|
|
|

|
Hi mw811,
I am starting to use the MS chart control in C++ for displaying a x-y plotter graph. But i am not able to figure out how to display a set of 32(x,y) values which range from 0-360 degrees. Could you please help me out? Also is there any help for using mschart in vc++?
Awaiting your reply.
Thanks,
Krishna.
|
|
|
|

|
I never use MS Chart, I must Chart atypical.
I draw on Static Img and create chart.
I queston this forum because look ideal(perfect) chart and simple.
Sorry for my english I learn hard.
mw811.
ss
|
|
|
|

|
How to hide grid lines in the plot
Vinod Tanaji patil
|
|
|
|

|
Goto "AxisGrid" tab, and, for each of the Axis combo option, select the Style as "NULL" from MajorGridlines/MiniorGridlines. THATS IT.
|
|
|
|

|
or dynamically:
int ChartXAxis = 0;
_variant_t varIndex((long) 0);
CVcAxis xAxis(m_Chart.GetPlot().GetAxis(ChartXAxis, varIndex ));
//Remove GridLines
xAxis.GetAxisGrid().GetMajorPen().SetStyle(0);
xAxis.GetAxisGrid().GetMinorPen().SetStyle(0);
yAxis.GetAxisGrid().GetMajorPen().SetStyle(0); //not able to "off" this gridline, why?
yAxis.GetAxisGrid().GetMinorPen().SetStyle(0);
|
|
|
|

|
Hi,
is the MS Chart Control free to use? Can I integrate it in a commercial software without licence costs?
Thanks for any information,
Tom
|
|
|
|

|
Yes, it is FREE.
You can do, whatevery you want.
|
|
|
|
|

|
CMSFlexGrid is the main class, you use mostly.
Others are required, if you want to manipulate the smaller parts of the graph, otherwise, hou can just neglect them.
|
|
|
|

|
How to define the Colors of the Graphs? I would like to define the colors.
|
|
|
|

|
If you are talking about changing the line colors, you can do that, from the "Series Color" tab.
|
|
|
|

|
This is possible to do it within the program itself. Here is a sample of how to change the background color of the graph...
m_chart.GetPlot().GetBackdrop().GetFill().SetStyle(1);
m_chart.GetPlot().GetBackdrop().GetFill().GetBrush().GetFillColor().Set(10, 10, 10);
Chris
|
|
|
|

|
Hi, how can I add an x and y label in an MsChart control? I can't find a solution to that anywhere. Also does anybody know how to implement some sort of zooming function? Perhaps somebody can help me as well by telling me where to find a reasonably good help file for the MSChart control when used with Visual C++. I can only find a help file for Visual Basic. Thanks.
|
|
|
|

|
Hi djteambse,
I am starting to use the MS chart control in C++ for displaying a x-y plotter graph. But i am not able to figure out how to display a set of 32(x,y) values which range from 0-360 degrees. Could you please help me out? Also is there any help for using mschart in vc++?
Awaiting your reply.
Thanks,
Krishna.
|
|
|
|

|
3 years late reply, but still....might come in handy for someone else
no proper help file for VC++ consumption, you have to stumble, google and make your way
Addin x & y label:
_variant_t varIndex((long) 0);
CVcAxis xAxis(m_Chart.GetPlot().GetAxis(0, varIndex ));
CVcAxisTitle xAxisTitle(xAxis.GetAxisTitle());
xAxisTitle.SetVisible(true);
//spruce up title
xAxisTitle.GetVtFont().SetStyle( e_ChartFontStyleBold );
CString strRowTitle = _T("XTitle");
xAxisTitle.SetText(strRowTitle);
//Set Y-axis Title
CVcAxis yAxis( m_Chart.GetPlot().GetAxis( 1, varIndex ) );
CVcAxisTitle yAxisTitle( yAxis.GetAxisTitle() );
yAxisTitle.SetVisible( true );
//spruce up title
yAxisTitle.GetVtFont().SetStyle( e_ChartFontStyleBold );
CString strColumnTitle = _T("YTitle");
yAxisTitle.SetText( strColumnTitle );
|
|
|
|

|
What version of Office did you use while writing this article? More precisely, which Chart version did you use?
I have Office XP and it provides both the 9.0 (2000) and 10.0 (XP) versions.
Some (or all) of the methods you use in your code don't exist in the ClassWizard-generated interfaces for Chart 9.0.
|
|
|
|

|
hmm,
i saw also MicroSoft Office Chart components v9.0 & v10.0.
But here the story is about
MicroSoft Chart
|
|
|
|

|
Looks pretty nice ... i've tried to use the demo on my pc, but the program does not startup.
I've looked for the charting control ... but i could not find it.
Any idea where i can get the control from ?
Please give me a "link" for a download.
|
|
|
|

|
Most likely it is part of MS Office.
|
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
Setting data and labels on the MS Chart control using VC++
| Type | Article |
| Licence | |
| First Posted | 14 Jun 2003 |
| Views | 167,735 |
| Bookmarked | 63 times |
|
|