简体   繁体   中英

Spotfire Table Visualization column width

Is there a way to set Spotfire Table visualization column width either through Java or Python script. i can able to change the column width manually but whenever the value changes through property control it reset again. I need to set constant column width. Thanks in advance.

from Spotfire.Dxp.Application.Visuals import TablePlot

# Tab is the (Visualization) parameter passed to the script specify the table to work on
dataTable= Tab.As[TablePlot]().Data.DataTableReference

# Get a handle to the Table plot
table = Tab.As[TablePlot]()

# Get the ColumnCollection for the Table plot
columns = table.TableColumns

# Size all of the columns 
for x in columns: 
    x.Width = 200

good question! you can add an IronPython script (I don't believe it's possible to do this using Javascript unless you are some kind of wizard, or otherwise hate yourself :) to do this pretty simply.

I'll put the examples all in one code snippet, but obviously you would only want to do one of these loops at a time. the snippet expects a parameter called viz whose value is the TablePlot visualization you wish to modify.

from Spotfire.Dxp.Application.Visuals import TablePlot

v = viz.As[TablePlot]()

# increase all column widths by 10 pixels
for col in v.Columns:
    col.Width = col.Width + 10


# set all column widths to 100 pixels (the default value)
for col in v.Columns:
    col.Width = 100


# set the width of a specific column to 50 pixels
for col in v.Columns:
    if col.Name == "My Column":
        col.Width = 50

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM