Jump to content
Software FX Community

Export Using DLL in VB


User (Legacy)
 Share

Recommended Posts

Hi, I am trying to write a VB 6.0 ActiveX DLL using the Chart FX dll.

When I use the following code to create a chart and export to a file, I

see nothing on the file. Can anyone help?

Thanks in advance.

Dim CfxChart As ChartFX

Dim j, i As Integer

Set CfxChart = New ChartFX

Randomize

CfxChart.OpenDataEx COD_VALUES, 2, 10

For i = 0 To 1

For j = 0 To 9

CfxChart.ValueEx(i, j) = Rnd * 100

Next j

Next i

CfxChart.CloseData COD_VALUES

CfxChart.Export CHART_METAFILE, "c:\temp\test.emf"

Link to comment
Share on other sites

The following article in our support site explains how to do this:

Q1371042. Creating charts dynamically from VB

Here is some sample code

Dim Chart As Object

Dim ChartObj As ChartFX

Private Sub Form_Load()

Licenses.Add "ChartFX.Chart", "YOUR LICENSE STRING GOES HERE"

Set Chart = Controls.Add("ChartFX.Chart", "chart")

' ActiveX control properties

Chart.Width = 6000

' Chart FX Properties and Methods

Set ChartObj = Chart.object

ChartObj.Gallery = LINES

ChartObj.UpdateSizeNow ' Very important if Export is called before the

chart is made visible

ChartObj.Export CHART_BITMAP, "C:\Chart1.bmp"

End Sub

--

FP

Software FX

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

I am trying to do something similar in VB6 and I got the export of

CHART_CFXOLEFILE format to a .chd file to work via the following code. But

an export of CFXOLEFILE format to clipboard does not work. I have tried the

ActiveX control as well as DLL (both version 5.0.14.1) with same results.

The clipboard viewer on XP gives an error "Format not supported by office

clipboard". This is with VB6, Office 2003 and ChartFX developer studio.

Please help. Here's the code:

Sub main()

Dim ChartFX1 As ChartfxLib.ChartFX

Licenses.Add "ChartFX.Chart", "licensekey"

Set ChartFX1 = New ChartfxLib.ChartFX

'CreateObject("ChartFXLib.ChartFX")

Dim CfxArray As New CfxDataArray

Dim x(3) As Double

Dim Lab(3) As String

x(0) = 0.3

x(1) = 0.5

x(2) = 0.2

Lab(0) = "Large Cap Core Equity"

Lab(1) = "Mid Cap Core Equity"

Lab(2) = "High Yield Fixed Income"

' Add arrays

CfxArray.AddArray x

CfxArray.AddArray Lab

ChartFX1.GetExternalData CfxArray

ChartFX1.RGBBk = RGB(255, 255, 255)

ChartFX1.Chart3D = False

ChartFX1.Gallery = GANTT

ChartFX1.LineStyle = 0

ChartFX1.MultipleColors = True

ChartFX1.PointLabels = True

'ChartFX1.PointLabelAlign = LA_LEFT Or LA_BOTTOM

ChartFX1.LeftGap = 160

ChartFX1.Title(CHART_TOPTIT) = "Allocation by Style"

ChartFX1.Volume = 80

'ChartFX1.Axis.Item AXIS_X.Format = AF_PERCENTAGE

'ChartFX1.Axis(AXIS_X).ClearLabels

ChartFX1.PrintIt 0, 0

'ChartFX1.UpdateSizeNow

'ChartFX1.Export CHART_METAFILE, "" 'this works with DLL but not with

the ActiveX control

'ChartFX1.Export CHART_CFXOLEFILE, "" 'why won't this line work??

ChartFX1.Export CHART_CFXOLEFILE, "c:\chartfx_v2.chd" 'this works

Set ChartFX1 = Nothing

Set CfxArray = Nothing

End Sub

InheritFromChart.zip

Link to comment
Share on other sites

Got it to work.  I did want to use the office add-on so that I could paste

it into a word document using automation.

The issue was the office add-on was not working with ChartFX Dev Studio. It

started working after I installed ChartFX client server 5.1 and re-installed

the office add-on.

Thanks for your help. But why does the "office add-on" not work on

computers with just dev studio??

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:XVTz368eEHA.3152@webserver3.softwarefx.com...

> What are you trying to do by exporting a binary file to the clipboard ?

> Nobody will understand this file format except for Chart FX.

>

> Do you wan to use the office add-in ?

>

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...