The Spotfire Community is moving to TIBCOmmunity and this forum location has closed. During the transition, you can still search the old forums but posting has been disabled. We encourage you to pick up the discussion at the new Spotfire community on TIBCOmmunity.
August 2010 - Posts - Tip of the Week

Tip of the Week

August 2010 - Posts

  • Sorting Bars Based Off Additional Dimensions

    Most people are aware that you can sort bars by height in a Bar Chart.  However, the height is always determined by the total values for a given variable that is on the X-Axis. For example , we can sort a Bar Chart by height to show the sum of sales in each store location, so that the locations with more sales are shown on the left in descending order, assuming the Store Location column is on the X-Axis as shown below.



     If we wanted to add another dimension to this Bar Chart, we could color by gender, still keeping the same sort order.

     

     
    What if we then wanted to sort by Males or by Females? There is no way to do this in a Bar Chart, but we can by using the Combination Chart.

    Create a Combination Chart with the same x and y axis as in the Bar Chart, and then select to Series by the Gender column, keeping both Females and Males as Bars.  Then click on the Appearance tab in the Combination Chart's properties dialog and select to sort the x-axis by either Female or Male.

     

     
    Below is the final output where the bars are sorted by total sales of Females per location.

     

     
    Switching to sort by Males will update the graph accordingly.

     
     

  • Exporting Hidden Trellis Pages in TIBCO Spotfire 3.2

    Everyone knows about Spotfire’s powerful trellis features already. But there is a new feature in Spotfire 3.2 which allows you to export hidden trellis pages to PDF or PowerPoint, and even hidden table rows too.


    Before we get to that, have a look at the screenshot below. If you are accustomed to creating a trellis using drag & drop, you may not know about the Pages setting which can only be accessed from the Properties dialog box.


     
    If you use this Pages feature, you will see a display similar to the one below. Note the scroll bar which has been added on the right side of a simple line chart: this is best used when your trellis variable has so many values that they cannot fit on any screen-size comfortably.


     

    So this is a great way to save space on the screen when you have a wide range of values in your trellis variable. But if you have used the Export to PowerPoint feature or, new in 3.2, Export to PDF, you may have wanted to show the hidden visualizations when you export.

    To do this, go to File > Export and choose either PowerPoint or PDF. If you choose any option in the drop-down box at the top (except for ‘Active Page’ or ‘All Pages’, unless you choose those labelled ‘new page for each visualization’) then you will also be able to check the box highlighted in red, which will give you a new slide/page for every hidden trellis panel, and will also allow you to export hidden table rows.
     

  • Creating page specific filtering with Filtering Schemes

    By default, when you create an Analysis file, filtering is global and affects all the pages in the Analysis. This means if you filter something on one page, it will affect visualizations on other pages for the same data table.

    In some cases, this is the desired effect, especially when you use one page to make selections and then you use a subsequent page to show details of those selections.  However, in many other cases, you may want to limit filtering to be specific to a page or some pages.  This can be accomplished by using multiple Filtering Schemes in your Analysis file. To turn on multiple Filtering Schemes, goto Edit > Document Properties, and then make the Filtering Schemes tab active.  On that tab, check the ‘Show filtering scheme menu in Filter Panel’ checkbox. It is on this tab, you can also create additional filtering schemes. 


    Once you are done, you can click OK, and you will now see a new section in the top of each Filter Panel which allows you to select which Filtering Scheme you want to apply to the current Page.

    You can create as many Filtering Schemes as you would like and then apply them to various pages as needed. 


    When would this be useful? Anytime you had an analysis file but wanted to break down the analysis into various categories, and show the results per category.  For example, suppose you are creating an Analysis file for that will show data across 3 major regions (North America, EMEA, and APJ). You may want to setup the Analysis so that there are  a couple pages for all the data combined, then a couple pages specific to each region.  In this case, you setup a Filtering Scheme for each region and also for one global view of your data. Then, you select the appropriate Filtering Scheme for each page.  In each Filtering Scheme, you filter the data to only show the rows specific to either a region or one for the global view.   


    While a topic like Filtering Schemes is a very powerful topic, it may not be the most intuitive to understand and locate without proper training. In fact, our Essentials training course for users covers many features and functionality which may go unnoticed inside TIBCO Spotfire Professional. Users who have been using Spotfire for years still find value and learn something new when attending these courses. See the following commercial to learn for yourself.

    If you are interested in attending any of our Essentials training courses, using classroom or blended delivery, please visit our user pathway page to learn more about the course and its schedule.


     

  • Marking Records using Property Controls

    By default Property Controls cannot be attached to a marking selection. However, by combining Script Controls with Property Controls, we can create the desired functionality.

    The first step is to create the Property Control(s). There are a variety of different ways to do this logic. First, you can use list box controls to show unique values in a column, and then mark the selected values. Or you can have one drop down to allow the user to select a column, and then a value to search for, and mark all rows where the specified column has the specified value.  We can even add multiple Property Controls to allow more complex logic (like if Col A = 3 and col B = ‘Boston’) and we can also use logical operators, like less than and greater than.

    Assume our data table includes information about various cars, including make, model, sticker price, engine size, fuel economy, etc….  We want to create a Property Control that allows a user to specify a minimum sticker price. For this we can use an Input field control type, and have the control attach to a Document Property of type real (since the sticker price column, MSRP, is also a real).


    We then need to create a Script Control which will mark the rows where the sticker price is greater than or equal to the value specified in the Property Control.  The Control will read in the minVal property created earlier as an input parameter.


     

     

    The entire script is below:

    from Spotfire.Dxp.Data import IndexSet
    from Spotfire.Dxp.Data import RowSelection
    from Spotfire.Dxp.Data import DataValueCursor
    from Spotfire.Dxp.Data import DataSelection

    rowCount = Document.ActiveDataTableReference.RowCount
    rowsToInclude = IndexSet(rowCount,True)
    rowsToMark = IndexSet(rowCount,False)

    cursor1 = DataValueCursor.CreateFormatted(Document.ActiveDataTableReference.Columns["MSRP"])


    for  row in  Document.ActiveDataTableReference.GetRows(rowsToInclude,cursor1):
       rowIndex = row.Index
       value1 = cursor1.CurrentValue
       if float(value1) >= float(minVal):
                  rowsToMark.AddIndex(rowIndex)

    Document.ActiveMarkingSelectionReference.SetSelection(RowSelection(rowsToMark), Document.ActiveDataTableReference)


    When complete the functionality will look something like below:

    .


     
    Remember that using this capability is not limited to a single column, so you can add in as much complexity into your logic a you want.

    If you are interested in learning more about the script listed above, or how to accomplish similar functionality, please consider taking our Script Controls training course.

    We have also just added a new section on our Community called Analytics Exchange where community members can post a variety of assets, including Script Controls, Expressions, Analysis Files shared via the Web, S+ and R Scripts and Data Functions, and Sample Data Sets.  I am including the script above in the Script Controls section. Please remember to check out the Exchange to search for and find useful content, and also please feel free to post content you have created which you wish to share with others.

Syndication

Other Spotfire Blogs

©Copyright 2000-2011 TIBCO Software Inc | Privacy Policy | Terms of Use I Blog I Contact Us I Content Center