turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- How to sort week number across year using JSL (JMP...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 18, 2017 2:46 PM
(1998 views)

I have data by week number from Oct 2016 to the current week. I want to show the week numbers in correct order on the X-axis on bar chart going from week 48, 49, 50, 51, 1,2,3 etc. Or value ordering for WeekNumber column in the order of time stamp can help.

I created Year as another column and used Year axis along with WeekNum on Bar chart. But it didn't work as expected. please see the attached charts. Left one is the one I am getting right now, and the right one is the desired one. For a small dataset, we can reorder the WW values but it's tedious for a large data set.

I am using JMP12, it will be a big help if anyone can suggest a solution.

4 ACCEPTED SOLUTIONS

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 18, 2017 5:57 PM
(3869 views)

Solution

Without seeing what you want your final product to look like, I will guess that what you may need to do is to change the Year and work week moding types to ordinal. Assuming the year and word week columns are numeric that should make the axis work out the way you want it to.

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 18, 2017 7:24 PM
(3869 views)

Solution

Thanks Jim. Yes, WW and Year are in numeric. but it didnt work out with ordinal modeling types for these columns.

Please see the attached chart. Desired chart is in the right and the one i am getting is in the left. Notice the week numbers. I had to reorder the week numbers to 49, 50, 51, 52, 1, 2.. which is quite tedious with large data set. Also i want to put it in script.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 18, 2017 7:53 PM
(3866 views)

Solution

If you use Chart Builder, setting Year and Work Week to Ordinal and dragging both of them at the same time to the X axis and then drag the Y variable to the Y axis you will get the below chart

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 27, 2017 12:04 AM
(3771 views)

Solution

Thanks so much for the help Jim. It worked.

Now i have to add this capability into my script. Was looking on web but didnt find any solution. Please let me know if you can suggest something.

5 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 18, 2017 5:57 PM
(3870 views)

Without seeing what you want your final product to look like, I will guess that what you may need to do is to change the Year and work week moding types to ordinal. Assuming the year and word week columns are numeric that should make the axis work out the way you want it to.

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 18, 2017 7:24 PM
(3870 views)

Thanks Jim. Yes, WW and Year are in numeric. but it didnt work out with ordinal modeling types for these columns.

Please see the attached chart. Desired chart is in the right and the one i am getting is in the left. Notice the week numbers. I had to reorder the week numbers to 49, 50, 51, 52, 1, 2.. which is quite tedious with large data set. Also i want to put it in script.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 18, 2017 7:53 PM
(3867 views)

If you use Chart Builder, setting Year and Work Week to Ordinal and dragging both of them at the same time to the X axis and then drag the Y variable to the Y axis you will get the below chart

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 27, 2017 12:04 AM
(3772 views)

Thanks so much for the help Jim. It worked.

Now i have to add this capability into my script. Was looking on web but didnt find any solution. Please let me know if you can suggest something.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 27, 2017 12:22 PM
(1872 views)

Are you asking, what is the JSL to do this chart? If this is your question, just go ahead and interactively create the chart, then go to the red triangle, click on it and got to Save the Script. You will get the code required to regenerate the chart.

Jim