I am in the process of using a linear scale as a way to show where setpoints are located. These are continuously changing and when they get to close it is hard to tell where they are. Is there a way to change the arrow into a line? I know you can with a dataset, but I can't find a way to do it with an indirect tag. Attached is an image.
What does this mean? Are you populating your indicators dataset somehow with an indirect tag?
However you are populating your table, point that at a custom property called rawData instead, making sure the style always defaults to arrow. Then, using the linear scale's propertyChange event handler, process the raw data whenever it changes to transform the style properties of the display dataset as needed. It's a simple matter of sorting the dataset on the value column and checking the difference between each row. If the difference is less than what is desired for arrows, set the style property to a line.
Example:
# If the raw data property changes
if event.propertyName == 'rawData':
# Sort the new data on its value property
newData = system.dataset.sort(event.newValue, 'value', True)
# Get the sorted values
values = newData.getColumnAsList(1)
# Define in pixels
# ...the minimum space between indicators that will allow an arrow to be displayed
minimumArrowGap = 3
# Iterate through all of the values, skipping the first one
# ...since it will be the secondary comparitor in the first iteration
for index, value in enumerate(values[1:]):
# If the current value is within three pixels of previous value,
# Change both indicators to a line
if value - values[index] < minimumArrowGap:
newData = system.dataset.setValue(newData, index, 'Style', 'Line')
newData = system.dataset.setValue(newData, index + 1, 'Style', 'Line')
# Set the indicators dataset to the newData
event.source.indicators = newData
Result:
5 Likes