Page 1 of 1

[DC_RMCHART] Data with negative values will not show tooltip

Posted: Tue Dec 29, 2015 1:29 am
by Andy Edward
Hi Roger,

I'm trying to make a stacked bar chart. I've found that when the data is negative, it will mess/ not show the tooltip.

I tried it at your samples/rmchart/dcchart.prg. Here is the code with everything else removed.

Code: Select all

#INCLUDE "dcdialog.CH"
#INCLUDE "dcgraph.CH"
#INCLUDE "dcprint.CH"

FUNCTION Main()

LOCAL GetList[0], GetOptions, oRmChart, oRegion1, oRegion2, oRegion3, ;
      oRegion4, oRegion5, oRegion6, aBarGroup[0], aLineGroup[0], aPie[0], ;
      aDonut[0], aBarGroupFloat[0], aBarGroupIndus[0], aLineGroupIndus[0], ;
      aDataAxis1[0], aDataAxis5[0], aDataAxis6[0], aLabelText, cRegSvr, ;
      cRmChart, cClsId, cRegQuery, aData, nWhich, oStatus

// cClsId := '\CLSID\{8E2EA06D-6ACA-4E52-9D5D-3CE2A89A15BE}'    // RMChart Version 3.xx
   cClsId := '\CLSID\{4D814D0F-7D71-4E7E-B51E-2885AD0ED9D7}'    // RMChart Version 4.xx

DC_DefDir(DC_CurPath()+'\')

cRegSvr := 'regsvr32.exe'

cRegQuery := DC_RegQuery(HKEY_CLASSES_ROOT,cClsId,'')
IF Valtype(cRegQuery) # 'C' .OR. Empty(cRegQuery)
  RunShell('rmchart.ocx /s',cRegSvr)
  cRegQuery := DC_RegQuery(HKEY_CLASSES_ROOT,cClsId,'')
  IF Valtype(cRegQuery) # 'C' .OR. Empty(cRegQuery)
    DC_WinAlert('Could not register RMChart OCX')
  ENDIF
ENDIF

* --- RMChart ActiveX Control --
@ 0,0 DCRMCHART oRmChart SIZE 1200, 800 RESIZE DCGUI_RESIZE_RESIZEONLY


DcAddBarGroup TO aBarGroupFloat DATA { 20,20,40,10,60,30 } ;
   TYPE RMC_BARSTACKED COLOR CornflowerBlue  ;
   STYLE RMC_BAR_HOVER

DcAddBarGroup TO aBarGroupFloat DATA { 10,30,50,10,70,20 } ;
   TYPE RMC_BARSTACKED COLOR Gold  ;
   STYLE RMC_BAR_HOVER

/****** THIS ONE IS FINE, COMMENTING IT OUT TO SHOW THE ISSUE *******/
//DcAddBarGroup TO aBarGroupFloat DATA { 15,35,55,15,75,25 } ;
//   TYPE RMC_BARSTACKED COLOR Maroon  ;
//   STYLE RMC_BAR_HOVER  
/*******************************************************************/

/********WILL NOT SHOW TOOLTIP FOR MAROON*******/
DcAddBarGroup TO aBarGroupFloat DATA { -10,-30,-50,-10,-70,-20 } ;
   TYPE RMC_BARSTACKED COLOR Maroon  ;
   STYLE RMC_BAR_HOVER   
/********WILL NOT SHOW TOOLTIP FOR MAROON*******/

DcAddDataAxis TO aDataAxis5 ALIGN RMC_DATAAXISLEFT MAXVALUE 100 MINVALUE -100 TICKCOUNT 11;

@ 5,800 DcChartRegion oRegion5 ;
   PARENT oRMChart ;
   FOOTER "(c) Copyright - Donnay Software Designs (2008)" ;
   SIZE 350, 350 PIXEL ;
   CAPTION TITLE 'Floating Bar Group Test' ;
   GRID ;
   LEGEND TEXT { 'This Year', 'Last Year', 'Some year' } ;
   DATAAXIS aDataAxis5 ;
   LABELAXIS LABELARRAY { 'Week 1','Week 2','Week 3','Week 4','Week 5','Week 6' } ALIGN RMC_LABELAXISBOTTOM ;
   BARGROUP aBarGroupFloat

DCGETOPTIONS RESIZE PIXEL

DCREAD GUI ;
    SETAPPWINDOW ;
    FIT ;
    TITLE 'DCRMCHART Sample Program' ;
    OPTIONS GetOptions ;
    EVAL {||oRMChart:RMCToolTipWidth := 100, ;
            oRMChart:RMCUserWatermark := 'eXpress++ RMChart System', ;
            oRMChart:RMCUserWMAlignment := RMC_TEXTRIGHT, ;
            oRMChart:RMCUserWMFontSize := 32, ;
            oRMChart:RMCUserWMLucent := 40, ;
            oRmChart:mouseDown := ;
            {|a,b,c,d,e,o|aData := e,nWhich := a,o:=Thread():new(),o:start({||BrowseCallbackData(nWhich,aData,oRMChart)})}, ;
            oRmChart:mouseMove := ;
            {|nMouseButton,b,nX,nY,aData|oRMChart:showToolTip( nMouseButton, nX, nY, aData )}, ;
            oRmChart:draw(), ;
            ShowDebugInfo(oRMChart), ;
            (wtf oRMChart:regions)}

RETURN nil

* --------------

STATIC FUNCTION BrowseCallbackData( nWhich, aData, oRMChart )

LOCAL GetList[0], oBrowse, nRegion

IF nWhich == 1 // left mouse button

  @ 0,0 DCBROWSE oBrowse DATA aData SIZE 30,37 NOHSCROLL FIT ;
        PRESENTATION DC_BrowPres() FONT '10.Lucida Console'

  DCBROWSECOL DATA {||oBrowse:arrayElement} HEADER 'Element' WIDTH 5 PICTURE '99' PARENT oBrowse
  DCBROWSECOL ELEMENT 1 HEADER 'Desc' WIDTH 20 PARENT oBrowse
  DCBROWSECOL ELEMENT 2 HEADER 'Data' WIDTH 15 PARENT oBrowse PICTURE '999999999.99'

  DCREAD GUI FIT ADDBUTTONS TITLE 'RMChart Mouse Data'

ELSEIF nWhich == 2 // right mouse button

  nRegion := aData[5,2]
  IF nRegion > 0
    DC_InspectObject( oRMChart:regions[nRegion] )
  ENDIF

ENDIF

RETURN nil

STATIC FUNCTION ShowDebugInfo( oRMChart )

/*
wtf oRMChart:Region(4):GridlessSeries
wtf oRMChart:Region(4):BarSeries(1)
wtf oRMChart:Region(1):BarSeries(1)
*/

RETURN nil
Any ideas on how to show the tooltip for data with negative values?

Regards,

Andy

Re: [DC_RMCHART] Data with negative values will not show too

Posted: Tue Dec 29, 2015 8:04 am
by rdonnay
This looks like a bug in RMCHART. It is returning an incorrect value (0) for the data index and series index in the array that gets passed to the tooltip code. This only happens if there are negative values in the data. I am trying to find a workaround but so far it has not been easy.

Re: [DC_RMCHART] Data with negative values will not show too

Posted: Tue Dec 29, 2015 5:48 pm
by rdonnay
I spent hours on this trying to find a workaround. No go. Sorry.

Re: [DC_RMCHART] Data with negative values will not show too

Posted: Sun Jan 03, 2016 7:31 pm
by Andy Edward
Hi Roger,

Thank you for your time. I guess we'll use the standard group bar instead

Regards,

Andy