Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Can COLUMN ChartType support ChartPointHoverCustomizer?

    SmartGWT 3.1, GWT 2.5.0

    We want to show attributes in the record other than the value being plotted. I can see LINE ChartType support this, how about COLUMN ChartType. If not, any other options?

    #2
    In what way do you want to show this additional information?

    If you mean showing stacked column charts, that's just setStacked().

    Comment


      #3
      No, it is not a multi series plot. It is more like a multi-axis plot, but instead of plotting the other 'axis', we want to show the data in a manipulated way on a hover text. It is like setDataValueFormatter's ValueFormatter.format() with the Record object in addition to the value.

      Comment


        #4
        You can use a mouseMove handler is combination with getNearestDrawnValue() if you want to implement a hover behavior that shows more data.

        Comment


          #5
          Let me restate the requirements. Say I have 5 records in my FacetChart data. For each record I have 4 attributes: X, Y, Extra1, Extra2. I am plotting X vs Y only, so a single series and single axis bar graph. When I mouse-over one of the 5 bars, I want to show a a tooltip with Extra1 & Extra2 (with some computation) in it for that record.

          I know SmartGWT can do it with ChartType=LINE. How do I do it with ChartType=COLUMN? Appreciate your help.

          Comment


            #6
            Right, same answer - use a mouseMove handler and getNearestDrawnValue if you want to add a hover that's different from the default.

            Comment


              #7
              So if I add a MouseOverEventHandler to the chart, onMouseOverEvent() I call getNearestDrawnValue(). That return a DrawnValue object. With that I still can't get the record of the mouse over bar, can I? Without the record, how can I get the other values from the attributes.

              Comment


                #8
                MouseMouse, not MouseOver.

                The FacetValues on the DrawnValue uniquely identify a record - you could use this with APIs like RecordList/ResultSet.find() if you need to look up the Record.

                Comment


                  #9
                  Tried that and got exception at 'drawnValue.getFacetValues()', what am I missing?

                  Code:
                                  public void onMouseMove(MouseMoveEvent event) {
                                      DrawnValue drawnValue = ((FacetChart)(event.getSource())).getNearestDrawnValue();
                                      FacetValueMap fvm = drawnValue.getFacetValues();
                                      String[] key = fvm.getFacetIds();
                                      SC.say("MouseMove on bar: " + key);
                                  }

                  Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) @com.smartgwt.client.widgets.BaseWidget::getAttributeAsJavaScriptObject(Ljava/lang/String;)([string: 'facetValues']): $wnd.isc[scClassName] is undefined
                  at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
                  at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
                  at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
                  at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
                  at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
                  at com.smartgwt.client.widgets.BaseWidget.getAttributeAsJavaScriptObject(BaseWidget.java)
                  at com.smartgwt.client.widgets.chart.DrawnValue.getFacetValues(DrawnValue.java:181)
                  at com.oatsystems.raf.smartgwt.client.chart.GridChartLayout$10.onMouseMove(GridChartLayout.java:487)

                  Comment


                    #10
                    This was fixed a while ago - get the latest patched build at smartclient.com/builds.

                    Comment


                      #11
                      Thanks. Now that the exception is fixed and I can get to the record I want when mouse move over it. How do I activate/deactivate the hover text on demand?

                      I know I can do
                      setShowValueOnHover(true);
                      setDataValueFormatter(new ValueFormatter() {...});

                      But that seems to conflict with MouseMoveEvent. MouseClickEvent is OK.

                      Should I implement my own popup window? Which widget should I use in that case?

                      Comment


                        #12
                        You would implement your own. You can use any widget, but consider Label and DetailViewer as possibilities.

                        Comment


                          #13
                          Note we have now added a drawnValue.getRecord() API that removes the need to look up the Record based on the facetValues (as we mentioned in post #8).

                          Comment

                          Working...
                          X