html
<span id="color">
<SpotfireControl id="Input Filed goes here" />
</span>
ColorPicker.js
colorInput = document.querySelector("#color input")
colorInput.type="color"
Here is a use case on how to use it.
changeColor.py
from Spotfire.Dxp.Application.Visuals import CombinationChart, CategoryKey
from System.Drawing import Color
# cast visual to combo chart
combinationChart = vis.As[CombinationChart]()
# get script parameters from doc props
category = CategoryKey("Banana")
# get the color from the color picker doc prop
hcolor = Document.Properties["color"] #hexadecimal color
color = Color.FromArgb(int(hcolor[1:3], 16), int(hcolor[3:5], 16), int(hcolor[5:7], 16))
# change the color for the corresponding category
combinationChart.ColorAxis.Coloring.SetColorForCategory(category,color)
No comments:
Post a Comment