Jump to content

Reset hierarchical slider on bar chart using IronPython


B I

Recommended Posts

Hi all

With a "reset button", I need to reset the hierarchy slider on the category axis of a bar chart to the "most specific" level (month):

 

I've tried achieving this by setting the X-axis expression in IronPython but this weirdly causes the "time" part (00:00:00) of the date data column to display alongside the month or year (see image below):

vis.As[LineChart]().XAxis.Expression = 'BinByDateTime([install Date],"Year.Month",1)'

Is there a better way to programmatically set the "hierarchy level" of the category axis Does anyone know how to suppress the appearance of the "time"

Thanks a lot,

Ben

Link to comment
Share on other sites

Thanks for the response.

 

Unfortunately, I am unable to use Bookmarks as I have been led to believe that they will interfere with (or poossibly override) our client log-in permissions. I'm really hoping to get an IronPython script that will replicate the functionality of a bookmark.

Link to comment
Share on other sites

Hi Ben,

Not sure how the bookmarks can override your client log in.

Regardless, solving this using IronPython can be done by using the date function to format the result from your BinByDateTime function.

vis.As[LineChart]().XAxis.Expression = 'Date(BinByDateTime([Date],"Year.Month",1)) AS ''Date'''

Another option would be to place < and > around the BinByDateTime function. This makes it a categorical value and retains the slider. Like this:

 

Best regards, Alain

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