We just upgraded from 8.0.12 to 8.1.0-rc2. Our Perspective project with Sparklines worked great prior to the upgrade. The sparkline displays machine speeds from tag history for current to 12 hours prior. Now, I get a red shade with green line and no data points on the Sparkline. The data table is 2 columns and 100 entries. Any idea why it doesn’t draw the sparkline anymore?
Good news: We already completed and tested a fix which was merged into 8.1.0 and will be part of the stable release. You won’t see this in the nightly releases, but as I said it WILL be in 8.1.0 stable.
One thing you can do in the meantime is apply a transform to your data:
points = []
for i in range(0, len(value)):
points.append({'x': i, 'y': value[i]['<your_Marquip_N_column_name>']})
return points
def transform(self, value, quality, timestamp):
"""
Transform the incoming value and return a result.
Arguments:
self: A reference to the component this binding is configured on.
value: The incoming value from the binding or the previous transform.
quality: The quality code of the incoming value.
timestamp: The timestamp of the incoming value as a java.util.Date
"""
points = []
for i in range(0,len(value)):
points.append({'x': i, 'y': value[i]['Marquip_Net_Sheets_Per_Hour']})
return points
I’m having an issue getting this to work with some indirection I am using. I have a sparkline template that I am passing the parameters to in order to pull the tag history.
I tried to manipulate the script to make it pull the tag .name value, which should by default be used as the column name but it is just returning a ScriptEval error.
Any ideas?
points = []
tagPath = self.view.params.key[0].path + ".name"
tagName = system.tag.read(tagPath)
for i in range(0, len(value)):
points.append({'x': i, 'y': value[i][tagName]})
return points
Don't do this. This tag read is going to loop and read that value for EVERY time the binding updates.
The reason you're getting a recursion error is because you're attempting to shoehorn in a Qualified Value instead of a simple value. The following change to your code will result in the code working, but you're going to have a huge performance hit in larger views if you continue to look up the tag value in the transform:
# make sure you double-check the line indentations - your posted code has too many tabs in the for loop
for i in range(0, len(value)):
points.append({'x': i, 'y': value[i][tagName.value]})
return points
for some reason this works about 50% of the time. If i am currently displaying the page in a browser and I save the project i get some values but not all. If I navigate away from the page and go back, the components are faulted again with the same fault.
I take it there’s probably not a better work around for now in my situation?
There was a known performance issues with the Sparkline component in RC1 and RC2. A side effect of the work we’ve been doing to improve performance overall. The issue has since been addressed in RC3, along with several other important changes. I’d highly recommend upgrading. Thank you.