Jump to content
We've recently updated our Privacy Statement, available here. ×

Script to set Bar and Line for different Series in CombinationChart


Chung-Kan Huang

Recommended Posts

Hi,

I have a combination chart currently setup using Series with follow custom expression

 

The numbers of series could change depend on the filter configuration.

I want to write a script that could loop through the series in a combination chart and set those data with Axis.Default.Names equal to "Obs" to Lines and "Model" to Bars.

Would it be possible

 

Thanks,

 

Kan

Link to comment
Share on other sites

  • 2 months later...

You can setup ironpython script as below

## import the necessary namespaces

from Spotfire.Dxp.Application.Visuals import *

 

#visual is a script parameter that contains your combination chart.

 

vc = visual.As[CombinationChart]()

vc.IndexedSeriesType.Clear()

vc.IndexedSeriesType.Item["Obs"]= CombinationChartSeriesType.Line

vc.IndexedSeriesType.Item["Model"]= CombinationChartSeriesType.Bar

Link to comment
Share on other sites

  • 9 months later...

Hi Janos,

 

A slightly different code worked for me:

## import the necessary namespaces

from Spotfire.Dxp.Application.Visuals import CombinationChart,CombinationChartSeriesType

#visual is a script parameter that contains your combination chart.

vc = visual.As[CombinationChart]()

vc.SeriesType = CombinationChartSeriesType.Bar

vc.IndexedSeriesType.Item["Sales"]= CombinationChartSeriesType.Bar

vc.IndexedSeriesType.Item["Share"]= CombinationChartSeriesType.Line

But you have to make sure (at least that was the case for me) that your Y axis columns are only one word. I had to rename my Class Sales column to Sales in order to have it work.

Kind regards,

David

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...