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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MsChart Control

Status
Not open for further replies.

mccartmd

Programmer
Feb 3, 2003
63
US
Hi:a few years ago I started using Mike Lewis' "simpleguide.vcx" (desires more stars for that!,) which uses mschart20lib.mschart2, which is I believe VB. In the MSProperties control it gives axis chocies of "show scale" ckbox and "autoscale" ckbox, which can be toggled on or off allowing manual imput.
I would like to be able to programically change the axis min and max based variable that is based on the raw data range + or -

I found this script under MSDM and am trying to see if I can work it into the vfp properties or methods.
any feedback is appreciated.

Private Sub Command1_Click()
' Increase the size of the chart plot.
MSChart1.Plot.AutoLayout = False
With MSChart1.Plot.LocationRect
.Min.x = .Min.x * 1.2
.Min.y = .Min.y * 1.2
.Max.x = .Max.x * 1.2
.Max.y = .Max.y * 1.2
End With
End Sub

Thank you
Mike
 
Hi Mike,

Glad you've found my control useful. (By the way, it's called SimpleChart, not SimpleGuide).

Basically, Simplechart is just a sublcass of MSChart. Whatever you can do in MSChart, you can in SimpleChart. So it's just a quesion of translating your VB code to VFP.

The following code could go in the chart's Init:

Code:
THIS.Plot.AutoLayout = .F.
WITH THIS.Plot.LocationRect
  .Min.x = .Min.x * 1.2
  .Min.y = .Min.y * 1.2
  .Max.x = .Max.x * 1.2
  .Max.y = .Max.y * 1.2
ENDWITH

I haven't tested this, but it should work.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi, thanks for your feedback.
My data range is from .980 to 1.020
"that is with decimals". If I set to AutoLayout= .T.
then it gives me a "Y" vertical axis scale from "0.000 to 1.200" making the visible chart line useless. I would like to be able to manually set AutoLayout = .F. but would like to be able to programically set them based on a "3 Point Decimal" field range with the Aixis Scale controled.This a min y axisscale of .980 and a max y axisscale of 1.020, Is this possible?
I attempted to use the following code. . .it works but what it does is, it changes the "whole" visible, but not the axis scale. . .that is it shrinks it or increases it as the case may be.

Any feeback would be deeply appreciated.
THX
Mike

. . .works,but not useful, shrinks whole visual.
THIS.Plot.AutoLayout = .F.
WITH THIS.Plot.LocationRect
.Min.y = .980
.Max.y = 1.020
ENDWITH
 
Hi:
Was able to get this code to work. . .

With This.Plot
This.Plot.Axis(1).ValueScale.Maximum=gnMax
This.Plot.Axis(1).ValueScale.Minimum=gnMin
Endwith

Thank you for the help
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top