Jump to content
We've recently updated our Privacy Statement, available here. ×
  • Visualize data as a line chart where the line color varies using a scatter plot with line connections


    This article show show to visualize data as a line chart where the line color varies using a scatter plot with line connections

    Introduction

    Sometimes it is useful to visualize data in a line chart, where the line color varies based on the primary measure, or based an other measure. Below is one such example in Spotfire, where a scatter plot has been used to show the price of fertilizer over time, and the line color varies according to the price.
    fertilizer_price_over_time.thumb.png.7a0c32cc1259cccf6c3c2f474eefd7de.png
     

    The regular line chart of Spotfire cannot achieve this, since it uses color to split the lines. However, as mentioned, the flexible scatter plot visualization can be used for this purpose instead. The trick is to use the line connection feature. Below follows a simple example where the data represents the price of fertilizer over time.

    Instructions

    Start by loading the data and then create a scatter plot like this:
    0._initial_scatterplot.thumb.png.ffafe19f8eb4f459defc902680da36dc.png
    Then open the Line Connection section of the scatter plot properties.
    1._properties.png.4f3bc391795e6456ad2c0edf5d5f0ab4.png
    Here we need to tell Spotfire how to connect the markers with lines. In this case, we want only one single line, so we can set the value of the expression under "Draw a separate line per value in" to <1>.
    2._properties.png.45fd70f95c0f339012a829510ea64e99.png
     

    Now, in the same section of the scatter plot properties, set the lines to be in the foreground and adjust the width of the lines to your liking.

    Then, in the Size section of the scatter plot, make the markers a small as possible in order to give the visualization the appearance of a line chart.

    Finally, lets go to the Color section of the scatter plot properties and select to Color by the column [Value].

    You can adjust the Color logic to your liking, for example, like the settings defined below.
    3._properties_and_finished_graph.thumb.png.df5566095b7fe8403a8f728d9dfca37c.png
     

    If you are interested in trying this out,  here is a DXP file in the resources that contains this example.

    fertilizer_price_index.zip

    fertilizer_price_index_posted_on_community.zip


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...