Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to add a vertical line to a chart whose x-axis is year month?

Hi,

      I tried to add a vertical line to my chart and I know that it requires x-axis has to be continous. My x-axis is year month, fore example 201101, 201102...201302. The problem is that the chart are totally changed after changing the data to continuous. How to handle this situation? Thanks

Longmatch

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Your YearMonth is just an integer showing YYYYMM, that's why your continuous numeric axis shows a large gap from e.g. 201112 to 201201 (89 increment instead of 1 increment).

I would suggest to create your YearMonth using an underlying QV date:

Timestamp#(YearMonthNM,'YYYY-MM') as YearMonth2

this should solve your issue (see also attached).

View solution in original post

12 Replies
Anonymous
Not applicable
Author

Totally changed in what way ?

You may need to force the yearmonth to be a number by wraping Num() around it, either in the script as another field, or in a calculated dimension.

If it's not that, then ...

Are all the dimension possible values added in ? This would be good for showing a continuous timseries.

Are you getting too long a series of dates now ? A calculated dimension or Dimension limits may help you to cutt out the earliest or latest dates.

You may need to

Jonathan

Not applicable
Author

I forced YearMonth to be a number in demension definition by using NUM(YearMonth), but the result is still the same after changing the x-axis to continuous. I think I got too many data points after convert the data to continuous. I do not know how to solve this problem. Please see my sample in the attachment, you will have a better idea about my problem. Instead of changing it to number, is this possible to change YearMonth to Date and make it continuous?

Thanks

Longmatch

swuehl
MVP
MVP

Your YearMonth is just an integer showing YYYYMM, that's why your continuous numeric axis shows a large gap from e.g. 201112 to 201201 (89 increment instead of 1 increment).

I would suggest to create your YearMonth using an underlying QV date:

Timestamp#(YearMonthNM,'YYYY-MM') as YearMonth2

this should solve your issue (see also attached).

Not applicable
Author

It worked perfectly. Thank you very much.

I do not know this function before. I do not think I know how to use it by reading the Help or user manual. I think there are many many more useful functions in Qlikiview. What is the best way to learn them?

A lot things I thought are not possible actually can be done with your helps. Thanks, thanks, many thanks.

Longmatch

maksim_senin
Partner - Creator III
Partner - Creator III

Hi,

Also you can try using Dual() function which allows a value to have both string and numeric representation at once.

Sorry have no time to experiment.

Best regards,

Maxim

Not applicable
Author

Somehow the YearMonth2 converted from Timestamp# function is still in YYYY-MM (2011-09) format and it displayed on the x-axis of my chart. After I changed the Dimension axis to continuous, 2011-01 became 40550 and 2011-02 became 40600. Not sure why?

swuehl
MVP
MVP

You need to set the format of the continuous axis to Date (and adapt the format code if needed) in number tab.

Check my attached sample how I did this.

But a continuous axis might be difficult to format exactely to your reqs (start / end / increment). That's one of the drawbacks of the continuous axis IMHO.

Not applicable
Author

Thanks. It works fine now.

After changed the dimension axis to continuous and change the data type to Date, the labels of x axis are way below the axis, please see the screen shot. Is there any way I can make it close to the x-axis? Another question is how to change the text of vertical line to vertical.

maksim_senin
Partner - Creator III
Partner - Creator III

Hi,

As for labels, the only way I know is to activate a chart, press & hold Ctrl+Shift, once you see red borders (wherever they appear) you can start moving/sizing them in order to adjust size and position of elements of the chart. Be careful, some moves can lead to negative results, but you can create copy of the chart or use Reset User Sizing/Docking buttons at the General tab of the chart properties dialog.

Best regards,

Maxim