How to Pass Marked Data into a Document Property

Consider this scenario, you have a calculation that necessitates the ability to pull a value from marked data. This is a complicated feedback system.

Setup the components

First, let’s setup the moving parts:

  • Create a document property ${sumMarkedRows}. This is going to be the document property that we’ll use in our calculation.
  • Created a text area. We need this so that our JavaScript can pass the data to the document property.
  • In the text area, add a Calculated value that is Sum([Column]).
  • Pick a marking layer that will facilitate this connection.

Connect the parts

Next we’ll need to pass that data from the marked layer to the calculated value to the JavaScript to the document property. What a mouthful!

  1. Create an input field for ${sumMarkedRows}
  2. Create a JavaScript that is called when the calculated value changes so we can pass it to the document property:

    <script>
    $(‘theIDoftheSpotfireCalcValue’).on(‘DOMSubtreeModified’,function(){
    $(‘theIDoftheInputfield’).text($(‘theIDoftheSpotfireCalcValue’).text());
    $(‘theIDoftheInputfield’).blur();
    })
    </script>

  3. That script needs the IDs swapped out then you can put it in the HTML area of that text area.
  4. Use ${sumMarkedRows} in your calculated column as the value that changes
  5. Wrap all of that with <div style=”display:none”>   …all the html…  </div> to hide that trickery

How to Force Button Labels to Wrap in Spotfire

We had a quick question on how to wrap buttons in Spotfire. Usually buttons come out like this when you don’t specify the length of the button.

But! If you specify specific dimensions, you’ll find that your button label will trail off into the distance like the button below.

We can employ some simple tricks in Spotfire to get this label to wrap. You’ll need to have the ability to write CSS scripts using the <style> tag. Your Spotfire administrator can turn this on for you. To begin, you’ll need to do the following:

  1. Create a text area.
  2. Create your button with the size you want.
  3. Open the text area into the HTML editor by right-clicking and selecting Edit HTML…

In the script below, you’ll want to add the <style> tag that I have listed below

The white-space property controls how text wraps inside the button. You’ll override this property to the “normal” way it works. The “!important” attribute overrides how Spotfire does this.

Presto! You’re all set.

Spotfire:  Using Document Properties to Reverse a Color Scheme Based on Desired Outcome

Have you ever wanted to reverse a Spotfire visualization color theme based on whether an outcome is desired or not?

For example, positive production almost always equates to a desired outcome while one might want to see CAPEX decrease.  If switching between the two options in a visualization via a Document Property, we might want to indicated a desired outcome as green and an undesired outcome as red rather than simply designating positive numbers as green and negative numbers as red.

Today, we will show you how to use a document property to create a switch, which will then alter the color scheme to denote whether an outcome is desired or undesired rather than positive or negative.

Read More

Keeping Spotfire Visualizations Working when Replacing Data by Using Column Properties

Do you ever try to replace data in a Spotfire dxp only to find many of the visualizations no longer work?

At Ruths.ai, we create Spotfire templates as one of our main products.  Often, people have to replace our source data with their own to utilize our templates.  However, this can cause some complications when they match columns with different names than the ones in our source data.  Ideally, people would like to keep their column names because the names have business implications. Yet, when that column name has been hard coded into a Spotfire expression, a visualization, calculated column, or data limiting expression could break.

Until now.

In this post, we will demonstrate how to use column properties to ensure that expressions will remain intact in a Spotfire dxp even after changing a column name when replacing data.    

Read More

Spotfire Malware Flag

Normally, I lead off with questions intending to help the user decipher whether the post is relevant to them.  In this case, the questions I came up with were almost too comical to take seriously.  Here they are anyway….

  • Are you suspicious that Spotfire is attacking your computer?
  • Has your company’s security team flagged Spotfire temp files?
  • Are you worried malware has been installed on your computer veiled as Spotfire files?

Read More

“Whiting Out” a Visualization Label in Spotfire

When using Spotfire, do you ever place a variable on an axis to make the visualization look a certain way, only to see its label show up unwanted next to the other necessary labels?

I’ve had this happen when manipulating dates or forcing a visualization (scatter plot, waterfall chart, bar chart) to be in a certain rank order.  Recently, I wrote a post on how to rank and order a gantt chart, which faced this issue.  I discussed how to remedy the issue in that article, but here I want to highlight the method used since we can use it in many other scenarios.

In this post, we will discuss how to white out a label on an axis.

Read More