1

I am constructing a chart to show stock values from a Google Spreadsheet macro, using Google App Script. I read the spreadsheet values into Charts.newDataTable(), then construct a filter with Charts.newNumberRangeFilter(). Then I bind the filter and LineChart together in a dashboard.

Now, what I really want is something like google.visualization.ChartRangeFilter in the Google API, a selectable range of dates to show in a graph. However for some reason, this isn't available from spreadsheet macros. So I am trying to make an alternative using NumberRangeFilter.

The problem I am having is that NumberRangeFilter allots a space on the X-axis of the chart for every date within the min and max of the range, regardless of whether or not I supply data for it. However, stock data is only valid for Mon-Fri of each week. That leaves two days of blank horizontal space between each week, and is not the desired effect I want. Here is a screenshot: screenshot

I also tried using CategoryPicker, as that allows me to control the values used, and also allows the use of Strings for dates, but that only allows me to choose one date at a time to add to the graph, and is not a good solution. There doesn't seem to be a way to use this with a slider bar.

Does anyone have any idea how to implement this in Google Spreadsheet based AppScript?

4

1 に答える 1

0

データがソートされている場合、番号を行番号に設定して、番号が連続するようにすることができます。ただし、フィルターはユーザーにとってわかりにくくなります。

数値列を使用してフィルター処理できますが、グラフでは日付列または文字列列を引き続き使用できます。下の図では、年と月を連続した数値に変換し、過去 12 か月にフィルターをかけ、フィルターを非表示にし、カスタム ラベルの x 軸に文字列列を使用しました。 チャート

ChartRangeFilter を追加するには未解決の問題があります。

于 2013-01-17T13:43:28.483 に答える