Page History
Wiki Markup |
---|
{anchor:top}
{toc: class=contents}
h2. 概要
{styleclass: Class=topLink}[ページトップ|#top]{styleclass}
コンテンツのロードを詳細にコントロールしたり、レポートまたはダッシュボードを適宜呼び出したり、(ユーザー入力に基づいて)表示オプションをダイナミックに設定したりする場合は、独自のスクリプトでAPIを直接呼び出すことができます。
API呼び出しを実行する前に、Javascript APIを含める必要があります:
{code:javascript} |
...
Table of Contents | ||
---|---|---|
|
Overview
Styleclass | ||
---|---|---|
| ||
If you want to have more control over the loading of content, call reports or dashboards on demand, or set display options dynamically (based on user input), you can call the API directly from your own script.
The Javascript API must be included before any API calls can be made:
Code Block | ||
---|---|---|
javascript | javascript | <script src="http://localhost/JsAPI" type="text/javascript"></script> |
A specific version of the API may be requested using the version
parameter:
Code Block | ||
---|---|---|
javascript | javascript | {code}
{{version{}}}パラメーターを使用して、特定バージョンのAPIをリクエストすることができます:
{code:javascript}
<script src="http://localhost/JsAPI?version=2.1" type="text/javascript"></script>
|
If the browser is unable to load the API, any calls to load reports or dashboards will fail. If you wish to detect whether the API has loaded successfully, you should check the variable window.yellowfin
is available:
Code Block | ||
---|---|---|
javascript | javascript | {code}
ブラウザーがAPIをロードできない場合、レポートまたはダッシュボードをロードするすべての呼び出しが失敗します。APIが正常にロードされたかどうかを検出するには、変数{{{}window.yellowfin{}}}が使用可能かどうかを確認します:
{code:javascript}
<script src="http://localhost/JsAPI" type="text/javascript"></script>
<script type="text/javascript">
if (!window.yellowfin) {
alert('Error loading API');
}
</script>
|
Server Information
Styleclass | ||
---|---|---|
| ||
After loading the API, some server information is made available:
Expand | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||
|
Example
Code Block | ||
---|---|---|
javascript | javascript | {code}
h2. サーバー情報
{styleclass: Class=topLink}[ページトップ|#top]
{styleclass}
APIをロードすると、一部のサーバー情報を使用できるようになります:
h3. {expand:title=ここを展開...}
|| ||説明||
| {{yellowfin.apiVersion}} | サーバーで使用しているAPIのバージョンです。 |
| {{yellowfin.baseURL}} | サーバー上のAPIに接続するために使用されるベースとなるURLです。 |
| {{yellowfin.serverInfo.releaseVersion}} | サーバーで実行しているYellowfinのリリースバージョンです(例:「6.1」)。 |
| {{yellowfin.serverInfo.buildVersion}} | サーバーで実行しているYellowfinのビルドバージョンです(例:「20120601」)。 |
| {{yellowfin.serverInfo.javaVersion}} | サーバーにインストールされているJavaのバージョンです。 |
| {{yellowfin.serverInfo.operatingSystem}} | サーバーで実行しているオペレーティングシステムです。 |
| {{yellowfin.serverInfo.operatingSystemArch}} | サーバーのオペレーティングシステムアーキテクチャです。 |
| {{yellowfin.serverInfo.operatingSystemVersion}} | サーバーのオペレーティングシステムバージョンです。 |
| {{yellowfin.serverInfo.schemaVersion}} | Yellowfin構成データベースのスキーマバージョンです。 |
{expand}
h3. 例
{code:javascript}
<script src="http://localhost/JsAPI" type="text/javascript"></script>
<script type="text/javascript">
if (window.yellowfin) {
alert('Yellowfin API loaded. Version: ' + yellowfin.apiVersion);
}
</script>
|
Loading a Report
Styleclass | ||
---|---|---|
| ||
A report is loaded by calling the yellowfin.loadReport
function:
Code Block | ||
---|---|---|
javascript | javascript | {code}
h2. レポートのロード
{styleclass: Class=topLink}[ページトップ|#top]
{styleclass}
レポートは、{{yellowfin.loadReport{}}}関数を呼び出してロードします:
{code:javascript}
yellowfin.loadReport(options);
|
Options are passed to the function as a Javascript object. These include a report identifier for the report you are loading, the elementId of the HTML element in which to load the report (or the element itself), and other options that alter the way the report is displayed. The available options are:
Expand | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||
|
Examples
This example loads a report into an element specified by its universal id, setting some initial display options:
Code Block | ||
---|---|---|
javascript | javascript | {code}
オプションは、Javascriptオブジェクトとして関数に渡されます。ロードしているレポートのレポート識別子、レポートをロードするHTML要素のelementId(またはelementそのもの)、およびレポートの表示方法を変更するその他のオプションなどがあります。使用可能なオプションは以下のとおりです:
h3. {expand:title=ここを展開...}
||オプション ||説明||
| {{reportUUID}} | {{reportUUID}}、{{reportId}}、{{wsName{}}}のいずれかが存在する必要があります。
ロードするダッシュボードを識別する固有のIDです。 |
| {{reportId}} | {{reportUUID}}、{{reportId}}、{{wsName{}}}のいずれかが存在する必要があります。
ロードするレポートを識別する数値のreportIdです。代わりに{{{}reportUUID{}}}パラメーターを使用することをお勧めします。 |
| {{wsName}} | {{reportUUID}}、 {{reportId}}、{{wsName}}のいずれかが存在する必要があります。
ロードするレポートを識別するWebサービス名です。代わりに{{{}reportUUID{}}}パラメーターを使用することをお勧めします。 |
| {{elementId}} | {{reportUUID}}、{{reportId}}、{{wsName{}}}のいずれかが存在する必要があります。
レポートをロードするHTML要素のIDです。 |
| {{element}} | {{elementId{}}}と{{{}element{}}}のいずれかが存在する必要があります。
レポートをロードするHTML要素です。 |
| {{showTitle}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、レポート上部のタイトルバーが省略されます。タイトルバーに含まれるすべての対話型ボタンも省略されます。 |
| {{showInfo}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、タイトルバーの情報ボタンが省略されます。 |
| {{showFilters}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、タイトルバーのフィルターボタンが省略されます。ユーザープロンプトフィルターは表示されません。 |
| {{showSections}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、タイトルバーのセクションボタンが省略されます(タブ形式または複数ページのセクションを使用するレポートの場合)。 |
| {{showSeries}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、タイトルバーのシリーズボタンが省略されます(シリーズ選択オプションを使用するレポートの場合)。 |
| {{showPageLinks}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、タイトルバーの前のページ/次のページボタンが省略されます(複数ページを使用するレポートの場合)。 |
| {{showExport}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、タイトルバーのエクスポートボタンが省略されます。 |
| {{height}} | デフォルト:囲み要素の寸法から自動的に検出します。
レポートの高さを上書きするには、数値を設定します。 |
| {{width}} | デフォルト:囲み要素の寸法から自動的に検出します。
レポートの幅を上書きするには、数値を設定します。 |
| {{display}} | デフォルト:{{chart{}}}
{{{}table{}}}に設定すると、レポートの初期状態がテーブルで表示されます。
{{chart{}}}に設定すると、レポートの初期状態がグラフで表示されます。
テーブルとグラフの両方が使用可能でないレポートでは無視されます。 |
| {{fitTableWidth}} | デフォルト:{{true{}}}
{{{}true{}}}に設定すると、レポートを囲み要素の幅に合わせようとします。 |
| {{canChangeDisplay}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、ユーザーがグラフ表示とテーブル表示を切り替えできるボタンが省略されます。 |
| {{filters}} | レポートに渡すフィルター値が格納されているオブジェクトに設定します。 |
| {{username}} | これを{{{}password{}}}パラメーターと共に設定すると、レポートをロードするときに特定のユーザーとして認証されます。ユーザーは制限されているレポートを表示する前に、ログインの詳細を入力する必要がありません。 |
| {{password}} | これを{{{}username{}}}パラメーターと共に設定すると、レポートをロードするときに特定のユーザーとして認証されます。 |
{expand}
h3. 例
ユニバーサルIDで指定された要素にレポートをロードし、初期の表示オプションをいくつか設定する例を示します:
{code:javascript}
var options = {};
options.reportUUID = 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63';
options.elementId = 'myReport';
options.showFilters = 'false';
options.showSeries = 'false';
options.display = 'chart';
options.fitTableWidth = 'false';
yellowfin.loadReport(options);
|
This example does the same thing with an anonymous options object:
Code Block | ||
---|---|---|
javascript | javascript | {code} 匿名オプションオブジェクトを使用して同様の処理を行う例を示します: {code:javascript} yellowfin.loadReport({ reportUUID: 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63', elementId: 'myReport', showFilters: 'false', showSeries: 'false', display: 'chart', fitTableWidth: 'false' }); |
This example passes the element directly rather than just its id:
Code Block | ||
---|---|---|
javascript | javascript | {code} IDではなく要素を直接渡す例を示します: {code:javascript} yellowfin.loadReport({ reportUUID: 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63', element: document.getElementById('myReport') }); |
Loading Report Filters
Styleclass | ||
---|---|---|
| ||
Filters used by a report can be loaded by calling the yellowfin.reports.loadReportFilters
function. To use this function, load the reports sub-API into your page along with the main API:
Code Block | ||
---|---|---|
javascript | javascript |
{code}
h2. レポートフィルターのロード
{styleclass: Class=topLink}[ページトップ|#top]
{styleclass}
レポートで使用されるフィルターは、{{yellowfin.reports.loadReportFilters{}}}関数を使用してロードすることができます。この関数を使用するには、メインAPIと共にレポートサブAPIをページにロードします:
{code:javascript}
<script src="http://localhost/JsAPI" type="text/javascript"></script>
<script src="http://localhost/JsAPI?api=reports" type="text/javascript"></script>
|
Then call the loadReportFilters
function:
Code Block | ||
---|---|---|
javascript | javascript | yellowfin{code} その後{{{}loadReportFilters{}}}関数を呼び出します: {code:javascript} yellowfin.reports.loadReportFilters(reportId, callback, arg); |
The first argument is the unique identifier for the report, which may either be a reportUUID
or a reportId
. We recommend using the reportUUID
where possible. The second argument is a callback function that will be called by the API when the filters for the report have been loaded. The first argument to the callback function will be the list of filters in the report. The second argument to the callback function will be the third argument supplied to the loadReportFilters
function (if specified).
The filters object returned as the first argument to the callback function is an array containing any filters used in the report. Each element in the array is an object containing information about that filter. These filter objects contain the properties:
Expand | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||
|
Examples
This example loads the report filters and displayed them to the user:
Code Block | ||
---|---|---|
javascript | javascript | {code}
1番目の引数はレポートの固有識別子で、{{reportUUID{}}}と{{{}reportId{}}}のいずれかです。可能な限り{{{}reportUUID{}}}を使用することをお勧めします。2番目の引数はコールバック関数で、レポートのフィルターがロードされたときにAPIによって呼び出されます。コールバック関数の1番目の引数は、レポートのフィルターリストです。コールバック関数の2番目の引数は{{{}loadReportFilters{}}}関数に渡される3番目の引数になります(指定した場合)。
コールバック関数の1番目の引数として返されるフィルターオブジェクトは、レポートで使用されるあらゆるフィルターが格納された配列です。配列の各要素は、そのフィルターに関する情報が格納されたオブジェクトです。これらのフィルターオブジェクトには以下のプロパティがあります:
h3. {expand:title=ここを展開...}
||プロパティ ||説明||
| {{filterUUID}} | フィルターの固有識別子です。 |
| {{filterId}} | フィルターの数値識別子です。 |
| {{nativeType}} | フィルターのネイティブデータタイプです。 |
| {{description}} | フィルターの説明です。 |
| {{operator}} | フィルターで使用される演算子です。 |
| {{display}} | フィルターで使用される表示スタイルです。 |
| {{dependencies}} | レポートの他のフィルターがこのフィルターに従属している場合はtrueに設定します。 |
| {{list}} | フィルターがリストスタイル(複数の値を許可する)の場合はtrueに設定します。 |
| {{between}} | フィルターが範囲スタイル(開始値と終了値が必要)の場合はtrueに設定します。 |
| {{listValues}} | フィルターがドロップダウンリストとして表示される場合は、このプロパティに使用可能なオプションのリストが格納されます。 |
{expand}
h3. 例
レポートフィルターをロードしてユーザーに表示する例を示します:
{code:javascript}
function filterCallback(filters) {
for (var i = 0; i < filters.length; i++) {
alert('Filter ' + filters[i].description + ' (' +
filters[i].filterUUID + '), display style: ' +
filters[i].display);
}
}
yellowfin.reports.loadReportFilters(
'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63', filterCallback);
|
This function can be used to load the available filters, and then pass them back to the loadReport
function to set up initial filter values for the report when it is loaded into the page. For example:
Code Block | ||
---|---|---|
javascript | javascript | {code}
この関数は、使用可能なフィルターをロードして{{{}loadReport{}}}関数に戻し、レポートがページにロードされるときのレポートのフィルター初期値を設定するために使用できます。例:
{code:javascript}
function filterCallback(filters) {
var filterValues = {};
for (var i = 0; i < filters.length; i++) {
if (filters[i].description == 'Country') {
filterValues[filters[i].filterUUID] = 'Australia';
} else if (filters[i].description == 'Start Date') {
filterValues[filters[i].filterUUID] = '2011-01-01';
} else if (filters[i].description == 'Invoiced Amount') {
filterValues[filters[i].filterUUID] = 6400;
}
}
// set up other options to load the report
var options = {};
options.reportUUID = 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63';
options.elementId = 'myReport';
// add the filter values
options.filters = filterValues;
// load the report
yellowfin.loadReport(options);
}
yellowfin.reports.loadReportFilters(
'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63', filterCallback);
|
Filter values passed to the loadReport
function should be specified as simple values as above. If the filter is a list style, multiple values can be set using an array:
Code Block | ||
---|---|---|
javascript | javascript | {code}
{{loadReport{}}}関数に渡されるフィルター値は、上記のように単純な値として指定する必要があります。フィルターがリストスタイルの場合は、配列を使用して複数の値を設定できます:
{code:javascript}
filterValues[filterUUID] = ['Australia', 'China', 'Italy'];
|
If the filter is a between style, the start and end values should be set using an array:
Code Block | ||
---|---|---|
javascript | javascript | {code} フィルターが範囲スタイルの場合は、配列を使用して開始値および終了値を設定する必要があります: {code:javascript} filterValues[filterUUID] = [500, 600]; |
The options.filters
element passed to the loadReport
function should contain values keyed either by filterUUID
or filterId
. We recommend using filterUUID
where possible.
Loading a Dashboard
Styleclass | ||
---|---|---|
| ||
A dashboard is loaded by calling the yellowfin.loadDash
function:
Code Block | ||
---|---|---|
javascript | javascript |
{code}
{{loadReport{}}}関数に渡される{{{}options.filters{}}}要素は、{{filterUUID{}}}または{{{}filterId{}}}でキー設定された値を含む必要があります。可能な限り{{{}filterUUID{}}}を使用することをお勧めします。
h2. ダッシュボードのロード
{styleclass: Class=topLink}[ページトップ|#top]
{styleclass}
ダッシュボードは、{{yellowfin.loadDash{}}}関数を呼び出してロードします:
{code:javascript}
yellowfin.loadDash(options);
|
Options are passed to the function as a Javascript object. These include an identifier for the dashboard you are loading, the elementId of the HTML element in which to load the dashboard (or the element itself), and other options that alter the way the dashboard is displayed. The available options are:
Expand | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||
|
Examples
This example loads a dashboard into an element specified by its id, setting some initial display options.
Code Block | ||
---|---|---|
javascript | javascript | {code}
オプションは、Javascriptオブジェクトとして関数に渡されます。ロードしているダッシュボードの識別子、ダッシュボードをロードするHTML要素のelementId(またはelementそのもの)、およびダッシュボードの表示方法を変更するその他のオプションなどがあります。使用可能なオプションは以下のとおりです:
h3. {expand:title=ここを展開...}
||オプション ||説明||
| {{dashUUID}} | 存在する必要があります。
ロードするダッシュボードの固有識別子です。 |
| {{elementId}} | {{elementId{}}}と{{{}element{}}}のいずれかが存在する必要があります。
ダッシュボードをロードするHTML要素のIDです。 |
| {{element}} | {{elementId{}}}と{{{}element{}}}のいずれかが存在する必要があります。
ダッシュボードをロードするHTML要素です。 |
| {{showTitle}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、ダッシュボード上部のタイトルバーが省略されます。タイトルバーに含まれるすべての対話型ボタンも省略されます。 |
| {{showInfo}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、タイトルバーの情報ボタンが省略されます。 |
| {{showFilters}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、タイトルバーのフィルターボタンが省略されます。分析フィルターは表示されません。 |
| {{showExport}} | デフォルト:{{true{}}}
{{{}false{}}}に設定すると、タイトルバーのエクスポートボタンが省略されます。 |
| {{height}} | デフォルト:ダッシュボード内のレポートの寸法から自動的に設定します。
ダッシュボードの高さを上書きするには、数値を設定します。ダッシュボードのレポートが多くのスペースを必要とする場合は、縦方向のスクロールバーが追加されます。 |
| {{width}} | デフォルト:ログインユーザーの設定またはシステム設定から自動的に設定されます。
ダッシュボードの幅を上書きするには、数値を設定します。
{{auto{}}}に設定すると、囲み要素の幅全体を使用します。 |
| {{filters}} | ダッシュボードに渡すフィルター値が格納されているオブジェクトに設定します。 |
| {{username}} | これを{{{}password{}}}パラメーターと共に設定すると、ダッシュボードをロードするときに特定のユーザーとして認証されます。ユーザーは制限されているダッシュボードを表示する前に、ログインの詳細を入力する必要がありません。 |
| {{password}} | これを{{{}username{}}}パラメーターと共に設定すると、ダッシュボードをロードするときに特定のユーザーとして認証されます。 |
{expand}
h3. 例
IDで指定された要素にダッシュボードをロードし、初期の表示オプションをいくつか設定する例を示します。
{code:javascript}
var options = {};
options.dashUUID = '3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9';
options.elementId = 'myDash';
options.showFilters = 'false';
options.showExport = 'false';
yellowfin.loadDash(options);
|
This example does the same thing with an anonymous options object:
Code Block | ||
---|---|---|
javascript | javascript | {code}
匿名オプションオブジェクトを使用して同様の処理を行う例を示します:
{code:javascript}
yellowfin.loadDash({
dashUUID: '3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9',
elementId: 'myDash',
showFilters: 'false',
showExport: 'false'
});
|
This example passes the element directly, rather than just its id:
Code Block | ||
---|---|---|
javascript | javascript | {code}
IDではなく要素を直接渡す例を示します:
{code:javascript}
yellowfin.loadDash({
dashUUID: '3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9',
element: document.getElementById('myDash')
});
|
Loading Dashboard Filters
Styleclass | ||
---|---|---|
| ||
Filters used by a dashboard can be loaded by calling the yellowfin.dash.loadDashFilters
function. To use this function, load the dashboard sub-API into your page along with the main API:
Code Block | ||
---|---|---|
javascript | javascript | {code}
h2. ダッシュボードフィルターのロード
{styleclass: Class=topLink}[ページトップ|#top]
{styleclass}
ダッシュボードで使用されるフィルターは、{{yellowfin.dash.loadDashFilters{}}}関数を使用してロードすることができます。この関数を使用するには、メインAPIと共にダッシュボードサブAPIをページにロードします:
{code:javascript}
<script src="http://localhost/JsAPI" type="text/javascript"></script>
<script src="http://localhost/JsAPI?api=dash" type="text/javascript"></script>
|
Then call the loadDashFilters
function:
Code Block | ||
---|---|---|
javascript | javascript | {code} その後{{{}loadDashFilters{}}}関数を呼び出します: {code:javascript} yellowfin.dash.loadDashFilters(dashUUID, callback, arg); |
The first argument is the unique identifier for the dashboard. The second is a callback function that will be called by the API when the filters for the dashboard have been loaded. The first argument to the callback function will be the list of filters in the dashboard. The second argument to the callback function will be the third argument supplied to the loadReportFilters
function (if specified).
The filters object returned as the first argument to the callback function is an array containing any analytical filters used in the dashboard, as well as filter group separators. Each element in the array is an object containing information about that filter or filter group. These objects contain the properties:
Expand | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||
|
Examples
This example loads the dashboard filters and displays them to the user:
...
function filterCallback(filters) {
for (var i = 0; i < filters.length; i++) {
alert('Filter ' + filters[i].description + ' (' +
filters[i].key + '), display style: ' +
filters[i].display);
}
}
yellowfin.reports.loadReportFilters(1234, filterCallback);
This function can be used to load the available filters, and then pass them back to the loadDash
function to set up initial filter values for the dashboard when it is loaded into the page:
...
function filterCallback(filters) {
var filterValues = {};
for (var i = 0; i < filters.length; i++) {
if (filters[i].description == 'Country') {
filterValues[filters[i].key] = 'Australia';
} else if (filters[i].description == 'Start Date') {
filterValues[filters[i].key] = '2011-01-01';
} else if (filters[i].description == 'Invoiced Amount') {
filterValues[filters[i].key] = 6400;
}
}
// set up other options to load the dashboard
var options = {};
options.dashUUID = '3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9';
options.elementId = 'myDash';
// add the filter values
options.filters = filterValues;
// load the dashboard
yellowfin.loadDash(options);
}
yellowfin.dash.loadDashFilters('3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9', filterCallback);
Filter values passed to the loadDash
function should be specified as simple values as above. If the filter is a list style, multiple values can be set using an array:
...
filterValues[key] = ['Australia', 'China', 'Italy'];
If the filter is a between style, the start and end values should be set using an array:
...
filterValues[key] = [500, 600];
The options.filters
element passed to the loadDash
function should contain values keyed by the keys
returned from the loadDashFilters
function.
horizontalrule |
---|
Styleclass | ||
---|---|---|
| ||
top
{code}
1番目の引数は、ダッシュボードの固有識別子です。2番目はコールバック関数で、ダッシュボードのフィルターがロードされたときにAPIによって呼び出されます。コールバック関数の1番目の引数は、ダッシュボードのフィルターリストです。コールバック関数の2番目の引数は{{{}loadReportFilters{}}}関数に渡される3番目の引数になります(指定した場合)。
コールバック関数の1番目の引数として返されるフィルターオブジェクトは、ダッシュボードで使用されるあらゆる分析フィルターと、フィルターグループ区切り文字が格納された配列です。配列の各要素は、そのフィルターまたはフィルターグループに関する情報が格納されたオブジェクトです。これらのオブジェクトには以下のプロパティがあります:
h3. {expand:title=ここを展開...}
||プロパティ ||説明||
| {{key}} | このフィルターまたはフィルターグループの固有キーです。 |
| {{type}} | このオブジェクトがフィルターグループを表す場合は{{FILTERGROUP}}に設定します。その他の値は、分析フィルターの種類を示します。 |
| {{description}} | フィルターまたはフィルターグループの説明です。 |
| {{groupId}} | フィルターグループの場合:グループの数値識別子です。 |
| {{state}} | フィルターグループの場合:グループが現在オープンの場合は{{OPEN}}に設定します。 |
| {{display}} | フィルターの場合:フィルターで使用される表示スタイルです。 |
| {{dependencies}} | フィルターの場合:ダッシュボードの他のフィルターがこのフィルターに従属している場合は{{true}}に設定します。 |
| {{list}} | フィルターの場合:フィルターがリストスタイル(複数の値を許可する)の場合は{{true}}に設定します。 |
| {{between}} | フィルターの場合:フィルターが範囲スタイル(開始値と終了値が必要)の場合は{{true}}に設定します。 |
| {{listValues}} | フィルターの場合:フィルターがドロップダウンリストとして表示される場合は、このプロパティに使用可能なオプションのリストが格納されます。 |
{expand}
h3. 例
<!-- /* Style Definitions */ table.MsoNormalTable {mso-style-name:標準の表; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0mm 5.4pt 0mm 5.4pt; mso-para-margin:0mm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";} -->
ダッシュボードフィルターをロードしてユーザーに表示する例を示します:
{code:javascript}
function filterCallback(filters) {
for (var i = 0; i < filters.length; i++) {
alert('Filter ' + filters[i].description + ' (' +
filters[i].key + '), display style: ' +
filters[i].display);
}
}
yellowfin.reports.loadReportFilters(1234, filterCallback);
{code}
<!-- /* Style Definitions */ table.MsoNormalTable {mso-style-name:標準の表; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0mm 5.4pt 0mm 5.4pt; mso-para-margin:0mm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";} -->
この関数は、使用可能なフィルターをロードして{{{}loadDash{}}}関数に戻し、ダッシュボードがページにロードされるときのダッシュボードのフィルター初期値を設定するために使用できます:
{code:javascript}
function filterCallback(filters) {
var filterValues = {};
for (var i = 0; i < filters.length; i++) {
if (filters[i].description == 'Country') {
filterValues[filters[i].key] = 'Australia';
} else if (filters[i].description == 'Start Date') {
filterValues[filters[i].key] = '2011-01-01';
} else if (filters[i].description == 'Invoiced Amount') {
filterValues[filters[i].key] = 6400;
}
}
// set up other options to load the dashboard
var options = {};
options.dashUUID = '3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9';
options.elementId = 'myDash';
// add the filter values
options.filters = filterValues;
// load the dashboard
yellowfin.loadDash(options);
}
yellowfin.dash.loadDashFilters('3b0b6c9a-9dfb-41f0-b85a-eb17bb8aeeb9', filterCallback);
{code}
<!-- /* Style Definitions */ table.MsoNormalTable {mso-style-name:標準の表; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0mm 5.4pt 0mm 5.4pt; mso-para-margin:0mm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";} -->
{{loadDash{}}}関数に渡されるフィルター値は、上記のように単純な値として指定する必要があります。フィルターがリストスタイルの場合は、配列を使用して複数の値を設定できます:
{code:javascript}
filterValues[key] = ['Australia', 'China', 'Italy'];
{code}
<!-- /* Style Definitions */ table.MsoNormalTable {mso-style-name:標準の表; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0mm 5.4pt 0mm 5.4pt; mso-para-margin:0mm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";} -->
フィルターが範囲スタイルの場合は、配列を使用して開始値および終了値を設定する必要があります:
{code:javascript}
filterValues[key] = [500, 600];
{code}
<!-- /* Style Definitions */ table.MsoNormalTable {mso-style-name:標準の表; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0mm 5.4pt 0mm 5.4pt; mso-para-margin:0mm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";} -->
{{loadDash{}}}関数に渡される{{{}options.filters{}}}要素は、{{loadDashFilters{}}}関数から返される{{{}keys{}}}でキー設定された値を含む必要があります。
\\
\\
{horizontalrule}
{styleclass: Class=topLink}[ページトップ|#top]
{styleclass} |