Página 1 de 1

Sobre RMChart - Mostrar Descripcion o Ventana Emergente

Publicado: Lun Ene 09, 2017 8:20 pm
por ryder1912
Buenas a todos, felices fiestas. Estoy realizando gráficos estadísticos para una empresa de transporte. En la foto se ve los viajes en un periodo (puede ser cualquier mes), los vehículos y la cantidad de viajes que estos realizan en el mes. Como se ve en la foto, la idea es que al hacer click sobre la patente se muestre una ventana o descripcion del vehículo (Marca, Modelo, Año, Cant.asientos, Kmts, etc.). ¿Es posible realizar eso? Obtener la patente y mostrar info. del auto?
Intente seguir el post dl usuario Moises sobre este tema pero no me salió, llegué hasta lo del puntero: http://www.xailer.com/forum/viewtopic.php?t=11881
Tambien probé con el showToolTip pero no hubo caso. Bueno x las dudas dejo adjunto la foto , el código y el proyecto. Saludos.
RMChart.rar
(15.15 KiB) Descargado 143 veces
flotaVeh.png
flotaVeh.png (39.48 KiB) Visto 2693 veces

Código: Seleccionar todo


#include "Xailer.ch"
#include "RMChartX.ch"

CLASS TForm1 FROM TForm

   COMPONENT oBevel1
   COMPONENT oBevel2
   COMPONENT btImprimir
   COMPONENT btCerrar

   DATA oChart

   METHOD CreateForm()
   METHOD FormInitialize( oSender )
   METHOD ArmaGrafico(aDatos)
   METHOD btImprimirClick( oSender )
   METHOD btCerrarClick( oSender )
   METHOD GetPatente( oSender, p1, p2, p3, p4, p5 )

ENDCLASS

#include "Form1.xfm"

//------------------------------------------------------------------------------

METHOD FormInitialize( oSender ) CLASS TForm1
local aDatos:={}

   ::lCentered:=.T.

   AADD(aDatos, 'Cantidad de Viajes por Vehiculos')
   AADD(aDatos, 'Periodo Enero de 2017')
   AADD(aDatos, 'N° de Patente (Cantidad de Viajes)')
   AADD(aDatos, 'NMN345*CDE234*CDFG32*TYA123*JKL789*TYD436*ERDGH65*OLH547*WES880*ERT321') // Patentes
   AADD(aDatos, '21*13*14*16*7*9*12*10*21*17') // Cantidad de Viajes x Vehiculo en el mes
   ::ArmaGrafico(aDatos)

RETURN Nil

//------------------------------------------------------------------------------
METHOD ArmaGrafico(aDatos)  CLASS TForm1
local nCantPat:=10 , nMaximo:=31

   ::lCentered:=.T.
   WITH OBJECT ::oChart := TRMChartX():New(::oBevel1)
      :nAlign := alCLIENT
      :Create()
   END

   WITH OBJECT ::oChart
     :Reset()
     :RMCBackColor = DullGreen
     :RMCStyle     = RMC_CTRLSTYLE3DLIGHT
     :RMCWidth     = ::oBevel1:nWidth
     :RMCHeight    = ::oBevel1:nHeight
     :RMCBgImage   = ""
     :Font         = "Tahoma"
     :MouseUpA     = "GetPatente"

     //************** Add Region 1 *****************************
     :AddRegion()
     With object :Region(1)
         :Left       = 5
         :Top        = 10
         :Width      = -5
         :Height     = -5
         :Footer     = ""
         :ShowBorder = FALSE
         //************** Add caption to region 1 *******************
         :AddCaption()
         With object :Caption
             :Titel     = aDatos[1]
             :BackColor = Bisque
             :TextColor = Black
             :FontSize  = 10
             :Bold      = TRUE
         End
         //************** Add grid to region 1 *****************************
         :AddGrid()
         With object :Grid
             :BackColor   = Cornsilk
             :AsGradient  = TRUE
             :BicolorMode = RMC_BICOLOR_NONE
             :Left        = 0
             :Top         = 0
             :Width       = 0
             :Height      = 0

         End
         //************** Add data Axis to region 1 *****************************

         :AddDataAxis()
         With object :DataAxis(1)
             :Alignment      = RMC_DATAAXISLEFT
             :MinValue       = "0"
             :MaxValue       = Str(nMaximo)
             :TickCount      = 10
             :Fontsize       = 8
             :TextColor      = Black
             :LineColor      = Black
             :LineStyle      = RMC_LINESTYLESOLID
             :DecimalDigits  = 0
             :AxisUnit       = ""
             :AxisText       = aDatos[2]
         End

         //************** Add label axis to region 1 *****************************
         :AddLabelAxis()
         With object :LabelAxis
             :AxisCount     = 1
             :TickCount     = nCantPat
             :Alignment     = RMC_LABELAXISBOTTOM
             :Fontsize      = 8
             :TextColor     = Black
             :TextAlignment = RMC_TEXTUPWARD
             :LineColor     = Black
             :LineStyle     = RMC_LINESTYLESOLID
             :AxisText      = aDatos[3]
             :LabelString   = aDatos[4]
         End

        //************** Add legend to region 1 *******************************
         :AddLegend()
         With object :Legend
             :Alignment = RMC_LEGEND_CUSTOM_UL
             :BackColor = LightYellow
             :Style     = RMC_LEGENDROUNDRECT
             :TextColor = Blue
             :Fontsize  = 8
             :Bold       = TRUE
             :LegendString:=""
         End

         //************** Add Series 1 to region 1 *******************************
         :AddBarSeries()
         :BarSeries(1):SeriesStyle     = RMC_BAR_FLAT_GRADIENT2
         :BarSeries(1):SeriesType      = RMC_BARSINGLE
         :BarSeries(1):ValueLabelOn    = RMC_VLABEL_DEFAULT_NOZERO
         :BarSeries(1):Lucent          = FALSE
         :BarSeries(1):Color           = Transparent
         :BarSeries(1):WhichDataAxis   = 1
         :BarSeries(1):PointsPerColumn = 1
         :BarSeries(1):HatchMode       = RMC_HATCHBRUSH_OFF
         :BarSeries(1):DataString      = aDatos[5]
     End
     :Draw( .T. )
   END

RETURN Nil

//------------------------------------------------------------------------------
METHOD GetPatente( oSender, p1, p2, p3, p4, p5) CLASS TForm1
LOCAL x, y, info, aPos, nFil1, nCol1, i
LOCAL oPop, nOption

   IF p1 == 1 // Botón izquierdo
         MsgInfo(   ValType( p5 ) )   // Info Detalle
      ELSEIF p1 == 2 // Botón derecho
          // Info Detalle 
   ENDIF

RETURN NIL

//------------------------------------------------------------------------------
METHOD btImprimirClick( oSender ) CLASS TForm1
   ::oChart:Draw2Printer()
   Printer:nOrientation:=DMORIENT_PORTRAIT
RETURN Nil

//------------------------------------------------------------------------------
METHOD btCerrarClick( oSender ) CLASS TForm1
   ::Close()
RETURN Nil

Re: Sobre RMChart - Mostrar Descripcion o Ventana Emergente

Publicado: Jue Ene 12, 2017 2:23 pm
por emeasoft
Hola,

Puede intentar hacerlo usando RMC_GetINFOXY para asignar el clic y RMC_COBox + RMC_COText para mostrar los datos.

Un Saludo,

André Corrêa

Re: Sobre RMChart - Mostrar Descripcion o Ventana Emergente

Publicado: Vie Ene 13, 2017 7:43 pm
por ryder1912
emeasoft escribió: Puede intentar hacerlo usando RMC_GetINFOXY para asignar el clic y RMC_COBox + RMC_COText para mostrar los datos.
Buenas, si estuve probando pero no sé como llamar a la funcion RMC_GetINFOXY o RMC_GetINFO, o cualquier otra.
En la ayuda del RMChart sale así: i = RMC_GetINFOXY(%ID_RMC1,TINFO,150,100). El tema es que el TInfo no sé si está difenido en algún lugar.

Algún ejemplo pasa saber como llamar a esas funciones ( RMC_GetINFOXY, RMC_COBox, RMC_COText) ?

Re: Sobre RMChart - Mostrar Descripcion o Ventana Emergente

Publicado: Lun Ene 16, 2017 12:01 pm
por emeasoft
Hola,

Puede echar un vistazo a las páginas "Mouse support", "Constants for the mouse support", "User Defined Type tRMC_INFO",
en la ayuda del RMChart.
No tengo ningún ejemplo listo, pero tan pronto como tengo tiempo, voy a tratar de crear uno.

Un Saludo,


André Corrêa