×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

FoxCharts/oChart error

FoxCharts/oChart error

FoxCharts/oChart error

(OP)
Hi experts: am trying to learn graphing. . . in vfp9...
(from Doug Hennig sample "Our first chart" FOXCHART)

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
* 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
*BROWSE opens ChartData and does joins just fine. . .placed foxchart.vcx on form. . .
with this.oChart as FoxCharts of FoxCharts.vcx
* But throws error says "oChart" not found
** oChart is the name of my blank form, trying to figure out what I am doing wrong.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

* Specify the chart type and other settings.
.Anchor = 15
.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

Any feedback would be deeply appreciated.
Lui

RE: FoxCharts/oChart error

Quote:

with this.oChart as FoxCharts of FoxCharts.vcx
* But throws error says "oChart" not found
** oChart is the name of my blank form, trying to figure out what I am doing wrong.

oChart if probably NOT the name of your blank form. oChart is probably the name of your chart control, which you should have placed on a form.

Where exactly are you running this code? I would expect it to be in the Init of the form. If so, it should run fine. If it is in the Load of the form, it won't work, because at that point the chart control has not yet been instantiated.

If it is in the Init of the chart control itself, it won't work because you you are referencing the control as this.oChart. In that case, you should just reference it as this (not followed by a full stop).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: FoxCharts/oChart error

(OP)
Thanks Mike, had the chart control in the load. . .
thanks for the help. Lu

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close