Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help requested in foxcharts library

Status
Not open for further replies.

ravicoder

Programmer
Apr 29, 2006
30
IN
Hi all

I recently came across the FoxCharts library which I thought could add value to my apps for providing various types of analysis

I was trying out some test data for this. I created a form with a cursor like below


CREATE CURSOR chartdata (reject_name c(20),mth1q n(3),mth2q n(3),mth3q n(3))

APPEND BLANK
REPLACE reject_name WITH 'Rejection 1',mth1q WITH 32,mth2q WITH 67,mth3q WITH 28
APPEND BLANK
REPLACE reject_name WITH 'Rejection 2',mth1q WITH 26,mth2q WITH 42,mth3q WITH 33
APPEND BLANK
REPLACE reject_name WITH 'Rejection 3',mth1q WITH 35,mth2q WITH 49,mth3q WITH 38

In the init of the form, I wrote code as below

With This.foxcharts1 As foxcharts Of foxcharts.vcx

.Anchor = 15
.ChartsCount = 1
.ChartType = 7
.ColorType = 0

.SourceAlias = 'chartdata'
.FieldAxis2 = 'reject_name'
.FieldLegend = .FieldAxis2
.Fields(1).fieldvalue = 'mth1q'

.DrawChart()

Endwith

I get output as a blank container in which the chart does not display. Can’t figure out what I am doing wrong. I have also tried writing a prg to run system.app first and then do form ….
My folder contains foxcharts.vcx/vct, gdiplusx.vcx/vct & system.app

Please Help. Any guidance would be highly appreciated

Thanks
Ravi




 
Before you try to create a chart from your data, the first thing to do when introducing a new library into your own project would be to get an example working.

For example this from
First create an empty new form,
Drag & drop a FoxChart on it, name it oChart and size it sufficiently large to see a result.

Then in form init copy the sample code:
Code:
* Get the data for the chart.
Open Database _samples + 'Northwind\Northwind'
Select Categories.CategoryName, ;
   sum(OrderDetails.UnitPrice * OrderDetails.Quantity) As Sales ;
   from Products ;
   join Categories On Products.CategoryID = Categories.CategoryID ;
   join OrderDetails On Products.ProductID = OrderDetails.ProductID ;
   group By 1 ;
   into Cursor ChartData
With This.oChart As FoxCharts Of FoxCharts.vcx
   * Specify the chart type and other settings.
   .Anchor = 15
   .ChartsCount = 1
   .ChartType = 7 && Bar
   .ColorType = 0
   * Specify the data for the chart.
   .SourceAlias = 'ChartData'
   .FieldAxis2 = 'CategoryName'
   .Fields(1).FieldValue = 'Sales'
   .FieldLegend = .FieldAxis2
   * Specify the chart and axis captions.
   .Title.Caption = 'Sales by Product Category'
   .SubTitle.Caption = ''
   .XAxis.Caption = 'Product Category'
   .YAxis.Caption = 'Total Sales'
   * Draw the chart.
   .DrawChart()
Endwith

Run the form and see if you get the result as shown in the PDF figure 3.



Chriss
 
Hi Chris

Thanks

I have done exactly that as given in the pdf but no success. the class just displays a blank box without the chart showing

I have written to doug hennig about this. hoping for a reply

Ravi
 
As tom hinted, I think he's right, it needs VFP9 to work.
Also, you need the full Source folder of Foxcharts, which also includes gdiplus.vcx and system.app

I don't think Doug Hennig will do anything, as the sample works 1:1 after doing all steps, the resulting chart is even resizable:
foxchart_gykowt.jpg


Chriss
 
To be clear about the files necessary:

From download the zip of the whole project

This lands in the Source folder:
foxchartfiles_oeptt7.jpg

The files I selected (highlighted) I deleted, so the remaining files need to be kept in the same directory:
foxcharts.vcx/vct
gdiplus.vcx/vct
system.app

Chriss
 
Hi Chris and Tom

Thanks for all the advice.

I downloaded all the latest service packs and hotfixes for VFP , installed them one by one

The foxcharts library is now working. I can now provide my applications with graphical analysis features

Hope this helps all the VFP community also

Thanks again
Ravi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top