Spotfire® Web クライアント ユーザー ガイド

IronPython スクリプトの例

このトピックでは、テキストエリア内のアクション リンクまたはボタンをクリックすることで実行できるいくつかのサンプル スクリプトをリストします。

追加の例およびテキストエリアにスクリプトを追加する方法の詳細な手順については、「テキストエリアまたはビジュアライゼーション項目にスクリプト アクションを追加する」を参照してください。Spotfire でのスクリプトの使用に関するチュートリアルおよび追加の例については、コミュニティの「Spotfire での IronPython スクリプト」を参照してください。
ヒント: expression パラメータが文字列プロパティ値に関連付けられている場合は、いくつかの事前定義された式の選択肢が含まれたプロパティ コントロール (ドロップダウン リストなど) を使用して、ビジュアライゼーションの軸に複雑な式を簡単に割り当てることができる分析を作成できます。プロパティ コントロールの追加方法については テキストエリアへのプロパティ コントロールの追加 を参照してください。

計算、オンデマンド データ、およびデータ関数の更新

# Example script that refreshes a table driven by
# a calculation, a data function
# or an information link loaded on demand.
# The script takes a parameter "table" of type DataTable
if table.IsRefreshable and table.NeedsRefresh:
table.Refresh()

SBDF ファイルのカラムを、現在の文書内のデータテーブルに追加する

# This script adds columns from an sbdf file to a data
table
# in the current document.
#
# Four arguments are expected:
# table - The data table in the current document
# that columns will be added to.
# path - The path to the sbdf file with columns to add.
# ColumnNameInTable - A column in the data table.
# ColumnNameInFile - A matching column in the sbdf file.
# The columns are used to join new data to the current data.
from Spotfire.Dxp.Data.Import import SbdfFileDataSource
from Spotfire.Dxp.Data import AddColumnsSettings, JoinType,
DataColumnSignature, DataType
# Create the join condition map. The column with the name
# specified in ColumnNameInTable from the current data table
# will be joined with ColumnNameInFile in the sbdf file.
columnInTable =
DataColumnSignature(table.Columns[ColumnNameInTable])
columnInFile = DataColumnSignature(ColumnNameInFile,
DataType.String)
joinConditionMap = {columnInTable : columnInFile}
ignoredCols = [ ]
settings = AddColumnsSettings( joinConditionMap,
JoinType.InnerJoin, ignoredCols)
ds = SbdfFileDataSource(path)
table.AddColumns(ds, settings)

特定のビジュアライゼーション ("Visual") を入力として使用して、ビジュアライゼーションの X 軸を変更する

# Sets the value of the XAxis Expression of a visual.
# This script expects two arguments:
# visual - The visual to the set the X-axis expression on.
# expression - The expression to set.
from Spotfire.Dxp.Application.Visuals import VisualContent
# Get the content of the visual. Use the most general type
# so that the script works for all VisualContent classes that
# have an X-axis property.
vc = visual.As[VisualContent]()
vc.XAxis.Expression = expression