Forum Discussion

Ivashamagnus's avatar
Ivashamagnus
Frequent Visitor
2 years ago
Solved

How to visualize sleep segments?

Hello!

 

Please tell me by what means in Power Bi I can indicate sleep periods on the chart?

 

I will be glad if you point me in the right direction. Watching tutorial videos doesn't help me.
Example in the picture.

  • lbendlin's avatar
    lbendlin
    2 years ago

    There is a learning curve with everything, but I found it to be really short with Deneb.  For your sample data the code is only this:

     

    {
      "data": {"name": "dataset"},
      "mark": {"type": "bar"},
      "encoding": {
        "x": {
          "field": "Date",
          "type": "nominal"
        },
        "y": {
          "field": "Start",
          "type": "temporal"
        },    "y2": {
          "field": "End"
        }
    
      }
    }

    and the result is this

     

4 Replies

  • I assume you want to know which custom visual can help you create similar charts?  I am pretty sure that Deneb can do that.  

     

    Not sure if I want to ask you for sample data - seems to be rather private information.

    • Ivashamagnus's avatar
      Ivashamagnus
      Frequent Visitor

      I am very glad that you answered me! I was almost desperate to get an answer. It looks like I will be learning about Deneb's capabilities in the near future.

      The data I collected for the graph.

      Spoiler
      date date date date The beginning of sleepThe end of the dreamsleep duration h\mintotal sleep h\min
      30.10.20234:009:305,30 
      31.10.20231:006:005,00 
      01.11.202321:304:006,30 
      02.11.20231:008:007,00 
      03.11.20231:308:006,30 
      04.11.20234:3012:007,30 
      05.11.20232:3010:308,00 
      06.11.202323:307:207,50 
      07.11.20230:008:308,30 
      08.11.20234:0010:006,00 
      09.11.20231:007:006,00 
      10.11.202323:509:309,40 
      11.11.20233:009:006,00 
      12.11.202323:408:208,40 
      13.11.20231:006:005,00 
      14.11.20230:309:309,00 
      15.11.20232:006:004,00 
      16.11.202322:306:207,50 
      17.11.20230:006:406,40 
      18.11.202322:306:508,20 
      19.11.20230:009:009,00 
      20.11.20232:309:006,30 
      21.11.20239:0013:006,00 
      22.11.20232:4010:408,00 
      23.11.20234:3014:009,30 
      24.11.20231:3010:309,00 
      25.11.20236:0013:307,307,30
      26.11.20236:0012:006,006,00
      27.11.20237:1012:205,105,00
      28.11.20235:009:004,004,00
      29.11.20239:0013:204,204,20
      30.11.20237:0013:306,306,30
      01.12.202322:0023:001,004,40
      01.12.20239:3013:103,40 
      02.12.20239:0014:005,005,00
      03.12.20238:0014:306,306,30
      04.12.20236:3015:008,308,30
      05.12.20230:000:000,000,00
      06.12.202313:0014:001,002,45
      06.11.202321:4523:301,45 
      07.12.20235:409:303,406,50
      07.12.202317:5021:003,10 
      08.12.20235:356:401,054,15
      08.12.202312:0015:103,10 
      09.12.202321:502:505,005,00
      10.12.202322:0023:401,407,20
      10.12.20237:2013:005,40 
      11.12.20237:1013:206,106,10
      12.12.20234:3012:007,307,00
      13.12.20236:3012:005,307,30
      13.12.202319:0021:002,00 
      14.12.20237:0015:008,008,00

      I haven't looked at a lot of information about Deneb and I have a question. Do you know if there is an easy way, a ready-made solution to display sleep segments on a graph? For example, if we are talking about just different charts about the amount of sleep, steps per day, etc. then there is no problem in Power Bi that it would be easy to do. To implement in Deneb, do you need to use JSON codes, Python, or is everything not as difficult as if you had to study matplotlib in Python? I am not a programmer, and when faced with the task of visualizing my dream as in the example in the picture, I am faced with the fact that I cannot find a simple solution for this as for simple graphs. I thought that in Power Bi it could be done simply)

      • lbendlin's avatar
        lbendlin
        Super User

        There is a learning curve with everything, but I found it to be really short with Deneb.  For your sample data the code is only this:

         

        {
          "data": {"name": "dataset"},
          "mark": {"type": "bar"},
          "encoding": {
            "x": {
              "field": "Date",
              "type": "nominal"
            },
            "y": {
              "field": "Start",
              "type": "temporal"
            },    "y2": {
              "field": "End"
            }
        
          }
        }

        and the result is this