7 Replies Latest reply: Aug 28, 2014 1:07 PM by Jonathan Poole RSS

    Display Time proportionally on the X-axis of a Line Chart?

      Can I configure Qlik Sense to display Time proportionally on the X-axis of a Line Chart? Currently each time data point is spaced equidistant from the previous one.

        • Re: Display Time proportionally on the X-axis of a Line Chart?
          Michael Tarallo

          Hi Phil, can you attach a screen shot please, to get a better picture?

           

          I think I know what you mean, but can't really articulate it. Such as mins within hours, where the mins are displayed as half tick marks on the axis, while the hours are larger tick marks, something like that? The mins are in proper portion to the number of hours, etc.?

           

          Thanks

           

          Mike

          • Re: Display Time proportionally on the X-axis of a Line Chart?
            Jonathan Poole

            Do you want to show all dates or time periods rather than just the ones in your data set ?

             

            An example below. Top chart shows the dates that exist in the data. Its Order data and there wasn't orders on every date. Bottom chart builds a date calendar with ALL dates between the min/max date in the data set... so everything is proportional.  Are you looking for something like the bottom chart display?

            Capture.PNG.png

             

            Here is the code i used in the loadscript.  ('data' is the name of my source data table that has the date field). Also the year and month field in the screenshot were computed off new date field that has all dates. )

             

            MaxMinDates:

            load

              max(Date) as MaxDate,

              min(Date) as MinDate

            Resident Data;

             

            let vMaxDate=Peek('MaxDate',0,'MaxMinDates');

            let vMinDate=Peek('MinDate',0,'MaxMinDates');

             

            Dates:

            load

              date(RecNo()-1 + $(vMinDate)) as ChartDate

            AutoGenerate ($(vMaxDate)-$(vMinDate)+1);

             

            drop table MaxMinDates;

             

            left join (Dates)

            Load

              Date as ChartDate,

                Date

            resident Data;

              • Re: Re: Display Time proportionally on the X-axis of a Line Chart?

                Hi guys, thanks for the replies. I have attached a screen shot that hopefully illustrates what I mean.

                 

                My data points are on an irregular time line: 02:00, 02:38, 03:38, 03:38, 04:39, 05:39, 06:00, 06:39, etc.

                 

                Currently each time seems to be distributed equidistant from the previous one on the time line. What I would like is to have them distributed proportionally depending on the time interval between them. I don't actually need to have labels for the specific times of the data, just time labels at regular intervals, like 02:00, 03:00, 04:00, 05:00, 06:00, etc.

                  • Re: Re: Display Time proportionally on the X-axis of a Line Chart?
                    Michael Tarallo

                    Hey Phil - I tired a simple - example and with the default product, I don't think it is possible to scale the X-Axis in this matter with a time value at the moment.

                     

                    Possibly jpe might have a solution, but I think it is more a function of the chart object itself.
                    If not we can push this to PM and open as a feature request.

                     

                    8-28-2014 11-17-31 AM.png

                    • Re: Re: Re: Display Time proportionally on the X-axis of a Line Chart?
                      Jonathan Poole

                      ***REVISED COMMENT**

                       

                      Phil - yes this is possible. As Mike says,  there currently isn't a feature to autopopulate the time or date axis with all time points or dates (whether there is data or not).  But the workaround is to introduce those data points into the data model through a technique in the 'load editor' .  This is what i did with the date example above. Your data goes down to the minute and so you will have 60x24 (=1440) potential bars for each days worth of data. That will introduce some sparsity potentially .

                       

                      For example, if my raw data is this:

                      Datetime2.PNG.png

                       

                       

                      Then my chart will be as follows.  The upper includes all minutes in the selection ... you can see 3 very spaced apart bars for the hour (3pm selected) .  The bottom is what you have. Just the 3 minutes are displayed but they are grouped as if the minutes came 1 after each other.

                       

                      dateTime1.PNG.png

                       

                      Attached is the QVF with the scripting required as well as the sample source data.  Its fairly generic and could be repeated in any QVF that has timestamps in the data.  Its therefore repeatable and reusable.

                       

                      This is a quick example and there are probably a few optimizations to be made as well . Feedback and better approaches are welcome.