Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: frank
  Where is frank?
 
 Indonesia
 frank
 To: Yousfi Benameur
  Where is Yousfi Benameur?
 El Bayadh
 Algeria
 Yousfi Benameur
 Tags
Subject: RE: FoxCharts
Thread ID: 310631 Message ID: 310692 # Views: 43 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Windows Vista and VFP
Date: Thursday, June 23, 2011 2:20:23 PM         
   


> > Hello all,
> >
> > I wonder if you guys can help me with the FoxChart class from vfpx.
> > I have a problem with recno() from the acoord array for charttype=4 (the points chart) since it is not giving me the right record number.
> > When I use different type of charttype like charttype=5, it is giving me the right record number.
> >
> > What is wrong is this:
> > with charttype=4 the recno() is 1,1,2,3,4,5
> > with charttype=5 the recno() is 1,2,3,4,5,6 (since it's the record number)
> >
> > This looks like not a big problem but when we have a multiple lines, the recno() is really critical to refer to the right corresponding columns to give a valid response to the user.
> >
> > I wonder if you guys can help me pointing out the wrong code in the foxchart class so I can fix this problem.
> > Thank you.
> >
> > frank sinatha
>
> Accordinatly to your datas,in your form.init put this code (make a particular attention to build the cursor).
>
> CREATE CURSOR mycurs (myChart1 n(8,2),   Month c(2))
> INSERT INTO mycurs VALUES( 12 , "1")
> INSERT INTO mycurs VALUES( 30,  "2")
> INSERT INTO mycurs VALUES( 17,  "3")
> INSERT INTO mycurs VALUES( 70,  "4")
> INSERT INTO mycurs VALUES( 84,  "5")
> INSERT INTO mycurs VALUES( 15,  "6")
> *brow
> 
> LOCAL loChart
> loChart = This
> 
> WITH loChart as FoxCharts of FoxCharts.Vcx
> .ChartType = 4 && pOINTS
> .ChartsCount = 1
> .SourceAlias = "mycurs"
> .FieldAxis2 = "Month"
> .FieldLegend = "Month"
> .Fields(1).FieldValue = "myChart1 " 
> .Fields(1).Legend = "myChart1 Legend "
> .Fields(1).Color  = RGB(100,175,213)
> * Setting the title and subtitle
> .Title.Caption = "FoxCharts points sample"
> .SubTitle.Caption = ""
> .FontName ="Tahoma"
> 
> * Setting the Chart Depth ( 3d effect )
> .Depth = 0
> * Set the backColor
> .BackColor = RGB(255,255,255)
> * Set the colors to Random
> .ColorType = 2 && Random
> * Set Colors to Gradient
> .BrushType = 2 && Gradient colors
> * Set the captions for the axis
> .XAxis.Caption = "Month"
> .YAxis.Caption = "DINARS"
> * Set the 2nd legend
> .AxisLegend2.Alignment = 0 && Left
> .AxisLegend2.Rotation = 0  && 0-360 degrees
> .AxisLegend2.FontName = "Verdana"
> .AxisLegend2.FontSize = 12
> * Draw the chart
> .DrawChart()
> ENDWITH
> 

>
> with this there is no problem see this result photo :
>
>
>
> Regards
> Yousfi Benameur

OK.

Then add this to the shapeMouseEnter event:
Pay attention to the "recno()" returning value, it is the loChart.aCoord(tnCoordIndex, 10).
And you will be amazed.
Try changing the charttype to 5 and see the results.


LPARAMETERS nButton, nShift, nXCoord, nYCoord, tnValue, tcLegend, tnCoordIndex
LOCAL lcText, loChart
loChart = Thisform.Foxcharts1

IF tnCoordIndex > 0

lcText = "X = " + TRANSFORM(loChart.aCoord(tnCoordIndex, 1)) + CHR(13) + ;
"Y = " + TRANSFORM(loChart.aCoord(tnCoordIndex, 2)) + CHR(13) + ;
"Width = " + TRANSFORM(loChart.aCoord(tnCoordIndex, 3)) + CHR(13) + ;
"Height = " + TRANSFORM(loChart.aCoord(tnCoordIndex, 4)) + CHR(13) + ;
"Value = " + TRANSFORM(loChart.aCoord(tnCoordIndex, 5)) + CHR(13) + ;
"Legend = " + TRANSFORM(loChart.aCoord(tnCoordIndex, 6)) + CHR(13) + ;
"Start = " + TRANSFORM(loChart.aCoord(tnCoordIndex, 7)) + CHR(13) + ;
"Sweep = " + TRANSFORM(loChart.aCoord(tnCoordIndex, 8)) + CHR(13) + ;
"Chart Index = " + TRANSFORM(loChart.aCoord(tnCoordIndex, 9)) + CHR(13) + ;
"RECNO() = " + TRANSFORM(loChart.aCoord(tnCoordIndex, 10)) + CHR(13) + ;
"Object Type = " + TRANSFORM(loChart.aCoord(tnCoordIndex, 11))

*!* .aCoord(n,1) = tnX
*!* .aCoord(n,2) = tnY
*!* .aCoord(n,3) = tnWidth
*!* .aCoord(n,4) = tnHeight
*!* .aCoord(n,5) = tnValue
*!* .aCoord(n,6) = Legend
*!* .aCoord(n,7) = tnStart
*!* .aCoord(n,8) = tnSweep
*!* .aCoord(n,9) = This.ChartRow && ChartIndex
*!* .aCoord(n,10) = RECNO()
*!* .aCoord(n,11) = tcObjType

=MESSAGEBOX(lcText,0,'')
ELSE
RETURN
ENDIF

*!* LOCAL lcText, loChart
*!* loChart = Thisform.Foxcharts1

IF tnCoordIndex > 0
thisform._ch_row = loChart.aCoord(tnCoordIndex, 10)
ELSE
thisform._ch_row = 0
ENDIF

frank sinatha

ENTIRE THREAD

FoxCharts Posted by frank sinatha @ 6/23/2011 5:02:24 AM
RE: FoxCharts Posted by Koen Piller @ 6/23/2011 9:10:21 AM
RE: FoxCharts Posted by frank sinatha @ 6/23/2011 2:20:57 PM
RE: FoxCharts Posted by Koen Piller @ 6/24/2011 2:49:10 AM
RE: FoxCharts Posted by frank sinatha @ 6/24/2011 3:50:59 AM
RE: FoxCharts Posted by Koen Piller @ 6/24/2011 10:39:52 AM
RE: FoxCharts Posted by Yousfi Benameur @ 6/23/2011 12:56:44 PM
RE: FoxCharts Posted by frank sinatha @ 6/23/2011 2:20:23 PM
RE: FoxCharts Posted by Yousfi Benameur @ 6/23/2011 3:02:45 PM
RE: FoxCharts Posted by frank sinatha @ 6/24/2011 3:53:04 AM
RE: FoxCharts Posted by Yousfi Benameur @ 6/24/2011 12:41:00 PM
RE: FoxCharts Posted by Koen Piller @ 6/24/2011 12:52:44 PM
RE: FoxCharts Posted by Yousfi Benameur @ 6/25/2011 8:34:02 AM
RE: FoxCharts Posted by Koen Piller @ 6/26/2011 1:36:07 AM
RE: FoxCharts Posted by Yousfi Benameur @ 6/26/2011 8:54:44 PM
RE: FoxCharts Posted by Mike Yearwood @ 6/27/2011 2:19:48 AM