Add a bar chart to a page

Description: Add a bar chart to a page.
Assumptions: An optional 'myPage' page type script parameter.

from Spotfire.Dxp.Application.Visuals import BarChart

#Pick one of the following Page reference options:
#myPage = Application.Document.Pages[0]            #Page index method
#myPage = Application.Document.ActivePageReference #Active page method
#myPage as a page type script parameter            #Script parameter method

#Add a chart to a page
myVis = myPage.Visuals.AddNew[BarChart]()
myVis.Data.DataTableReference = Document.Data.Tables["MyDataTable"]
myVis.Title = "New Bar Chart"