0

我有一个很烦人的问题。:)

visual = context.ActiveVisualReference;            
TablePlot tablePlot = visual.As<TablePlot>();            
colorings = tablePlot.Colorings;            
categories = colorings.GetCategories();            
coloring1 = colorings.GetColoringForCategory(categories[0]);            
coloring2 = colorings.GetColoringForCategory(categories[1]);            
coloring3 = colorings.GetColoringForCategory(categories[2]);            
category2 = categories[2];            
bool removed = colorings.Remove(coloring2);

这是我在自定义工具级别执行的 C# 代码,问题是我在 Web Professional(使用 5.5)中看不到 Remove 方法执行的任何效果。

根据文档,该方法应该从可视化中删除自定义颜色,但它不会。

也许需要调用一些刷新视图的方法,但我没有设法找到它。

请帮忙。:)

http://stn.spotfire.com/dxp/html/M_Spotfire_Dxp_Application_Visuals_ConditionalColoring_ColoringCollection_Remove.htm

4

1 回答 1

1

您是否在代码末尾尝试过 tablePlot.Colorings = colorings ?代码末尾的“已删除”的值是什么?

在 IronPython 中,这个是有效的:

from Spotfire.Dxp.Application.Visuals import TablePlot
print myVisual.Title  
myTablePlot = myVisual.As[TablePlot]();
print myTablePlot.Title      
myColorings = myTablePlot.Colorings;            
myCategories = myColorings.GetCategories();  
print myCategories.Count
myColorings.Remove(myColorings.GetColoringForCategory(myCategories[1]))
于 2014-10-08T13:46:20.273 回答