Thanks, I got it working, almost. How do you set the state (current min/max value) of a NumberRangeFilter? The control doesn't seem to have a setState() method.
Am Donnerstag, 9. März 2017 21:51:56 UTC+1 schrieb Daniel LaLiberte: > > You can treat a control like a chart, and draw it given data. If you > create the control yourself, rather than via the ControlWrapper, then do > e.g. myControl.draw(mydata, myoptions). If you create it with the > ControlWrapper, then treat it like a ChartWrapper: > https://developers.google.com/chart/glossary#chartwrapper > > Hope that helps. > > On Thu, Mar 9, 2017 at 3:35 PM, 'perspektive42' via Google Visualization > API <[email protected] <javascript:>> wrote: > >> Hi, >> >> It seems I still need a dashboard, otherwise there is no way to bind the >> control to a DataTable. >> >> Here's my try: >> >> google.charts.setOnLoadCallback(function(){ >> var container = document.createElement("DIV"); >> container.id = "slider"; >> controlUI.appendChild(container); >> var container2 = document.createElement("DIV"); >> container2.id = "slider2"; >> controlUI.appendChild(container2); >> >> var slider = new google.visualization.ControlWrapper({ >> 'controlType': 'NumberRangeFilter', >> 'containerId': 'slider', >> 'options': { >> 'filterColumnIndex': 0, >> 'minValue': yearRange.min, >> 'maxValue': yearRange.max} >> }); >> >> var tableChart = new google.visualization.ChartWrapper({ >> 'chartType': 'Table', >> 'containerId': 'slider2', >> 'options': { >> 'width': '100%', >> 'height': '100%', >> 'chartArea': {top: 0, right: 0, bottom: 0} >> } >> }); >> >> // Create the dashboard. >> var data = google.visualization.arrayToDataTable([ >> ['Year'], >> [yearRange.min], >> [yearRange.max], >> ]); >> var dashboard = new google.visualization.Dashboard(controlUI); >> dashboard.bind(slider, tableChart); >> dashboard.draw(data); >> }); >> >> This only gets me a "... failed to draw" error. >> >> >> Am Mittwoch, 8. März 2017 15:41:24 UTC+1 schrieb Daniel LaLiberte: >>> >>> Yes it is possible to use controls outside of dashboards, but they are >>> dependent on accessing a DataTable. Perhaps you can fake a datatable just >>> so it gets the right range. You don't need to use the filtered datatable >>> that results. >>> >>> You'll need to listen for the 'statechange' and 'ready' events. >>> >>> On Wed, Mar 8, 2017 at 8:10 AM, 'perspektive42' via Google Visualization >>> API <[email protected]> wrote: >>> >>>> Is it somehow possible to use controls (e.g. a DateRangeFilter) without >>>> a dashboard and without connecting it to a DataTable? I'd like to use it >>>> as >>>> a UI element to control elements in a Google Map (not within a chart). >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Google Visualization API" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at >>>> https://groups.google.com/group/google-visualization-api. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/google-visualization-api/6393c233-c9bc-4a33-8ec3-083a21990ce7%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/google-visualization-api/6393c233-c9bc-4a33-8ec3-083a21990ce7%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> >>> [email protected] 5CC, Cambridge MA >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Visualization API" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] >> <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at >> https://groups.google.com/group/google-visualization-api. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/google-visualization-api/c1a82f8a-0e03-4c92-b13a-e15fd32fd3fc%40googlegroups.com >> >> <https://groups.google.com/d/msgid/google-visualization-api/c1a82f8a-0e03-4c92-b13a-e15fd32fd3fc%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> > [email protected] <javascript:> 5CC, Cambridge MA > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/e8d2dab7-b689-4d4f-95b5-a7ec55cdf0ce%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
