Jump to content

Line chart with drop down property control.


Vipin K

Recommended Posts

I have a line chart with 2 lines. the formula for this looks like this: 

Sum([ontime]) / Sum([total]) as [ontime%], Sum([failure]) / Sum([total]) as [fail%]

they are appearing in Y axis as two different lines.

Now, I am trying to create a property control which would show either both lines or one of the lines at a time using drop down. but when i use below expression, I am getting error saying expression is not correct after 'as' because I am using two calculations?. Is there another way to fix this.

case

when ${all} = 'all' then Sum([ontime]) / Sum([total]) as [ontime%], Sum([failure]) / Sum([total]) as [fail%]

when ${ontime} = 'ontime' then Sum([ontime]) / Sum([total]) as [ontime%]

when ${failure} = 'fail' then Sum([failure]) / Sum([total]) as [fail%]

end

Link to comment
Share on other sites

In one case you expect two lines, in other cases only one, but Spotfire needs to always draw two lines.

I could not find a perfect solution, but maybe if you hide the legend (I had to colour by column names) and the Y-axis selector, it works better. You can make the colours self-explanatory like green for ontime and red for fail.

I also collapsed the three document properties 'all', 'ontime' and 'failure' into one called 'all', with possible values 'all','ontime' and 'fail':

case when '${all}' != 'fail' then Sum([ontime]) / Sum([total]) end as [ontime],case when '${all}' != 'ontime' then Sum([failure]) / Sum([total]) endas [fail]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...