RMC_CreateChart function.
Create a new chart

Syntax
nResult (LONG) = RMC_CreateChart(
ByVal nParentHndl (LONG),
ByVal nCtrlId (LONG),
ByVal nX (LONG),
ByVal nY (LONG),
ByVal nWidth (LONG),
ByVal nHeight (LONG),
Optional ByVal nBackColor (LONG),
Optional ByVal nCtrlStyle (LONG),
Optional ByVal nExportOnly (LONG),
Optional ByRef sBgImage (ASCIIZ),
Optional ByRef sFontName (ASCIIZ),
Optional ByVal nToolTipWidth (LONG),
Optional ByVal nBitmapBKColor (LONG)
)
Parameter
nParentHndl (LONG)
Handle of the parent window (= the dialog), in which the chart will be shown.
nCtrlId (LONG)
Unique ID of the control.
nX (LONG)
Upper left corner of the chart in the parent window (in Pixel).
nY (LONG)
Top corner of the chart in the parent window (in Pixel).
nWidth (LONG)
Width of the chart (in Pixel).
nHeight (LONG)
Height of the chart (in Pixel).
nBackColor (LONG)
Backcolor of the chart as a Color... constant. If omitted or 0: ColorAliceBlue.
nCtrlStyle (LONG)
Style of the chart as a control style constant. If omitted or 0: RMC_CTRLSTYLEFLAT.
nExportOnly (LONG)
If TRUE the chart cannot be displayed on the screen, it must be drawn with either RMC_Draw2File(), RMC_Draw2Printer() or RMC_Draw2Clipboard(). If omitted or 0: FALSE.
sBgImage (ASCIIZ)
The full name of the file for the background image, if you choose as nCtrlStyle
RMC_CTRLSTYLEIMAGE or RMC_CTRLSTYLEIMAGETILED.
With RMC_CTRLSTYLEIMAGE the image will be scaled accordingly the size of your chart, therefore you should choose an image size which has the same or a similar ratio of width and height as your chart and which should be rather bigger than smaller than your chart, if it has not the same size. Load file bars with image.rmc into the Designer for an example.
RMC_CTRLSTYLEIMAGETILED will not scale the image, but repeat it until the whole chart is filled with the image. This style is convenient if you want to use a small GIF or BMP to create a pattern or texture as background for your chart. Load file grouped bars.rmc into the Designer for an example.
If you use an image as background for your chart you normally should choose as nBackColor the constant %ColorTransparent (which you also should choose for the background of the grid in grid-based and XY charts, otherwise it covers your image). But you als could choose a color as background additional to the image: in this case the color will be painted semi-transparent over the image to generate a special effect. Load file donut with image.rmc into the Designer for an example of this case.
sFontName (ASCIIZ)
Name of a TrueType font, which shall be used. If omitted or 0: "Tahoma" is used.
nToolTipWidth (LONG)
If you want to have ToolTips for the data series of your chart, set the maximum width in pixel. That's all you have to do to get ToolTips when you move the mouse cursor over the data points. See also RMC_SetCustomToolTipText() and RMC_SetToolTipWidth()
nBitmapBKColor (LONG)
Sets the color for the bitmap, which is the "canvas" for all drawing routines. If omitted or 0: the same color is used as the background color of the window, which is parent of the chart control.
This parameter is very useful in three cases:
  • You choosed as nCtrlStyle RMC_CTRLSTYLEFLATSHADOW and you want to export your chart into a bitmap to include it in a website, which has another color than the window, in which you've created the chart: choose the same color for nBitmapBKColor to avoid the small (grey) rectangles in the upper right and lower left corner of your chart.
  • If you choose ColorTransparent for nBitmapBKColor, you will get a transparent chart control. In this case you must also choose ColorTransparent for parameter nBackColor and, if your chart is gridbased, for the grid to be able to "look through" your chart. Note: the control is not real transparent, it only simulates transparency, but as long as you don't move the control over the window, the transparency effect works very well.
  • You want to create a real transparent bitmap of your chart: choose ColorTransparent and write your chart into a *.emf file or a *.png file.
Return value
0
No error, function succeeded.
RMC_ERROR_PARENTHANDLE
Parent handle is 0.
RMC_ERROR_CTRLID
Wrong control ID (0).
RMC_ERROR_MAXINST
The maximum count of control instances (20) within one programm is exceeded.
RMC_ERROR_NOGDIP
No GDIPLUS.DLL was found.
RMC_ERROR_CREATEWINDOW
Error while creating window with CREATEWINDOWEX.