1

Creating a Line Graph With Year as X-Axis and a String as Y-Axis

I want to create a line graph in discover that shows all of the years as the x-axis and the company name as the y-axis. So like a line graph that shows that a company existed from 2009-2024 and another company existed from 2000-2014, and so forth. 

10 replies

null
    • Cindy_Tran
    • 4 mths ago
    • Reported - view

    Something like this image but x-axis would be years and y-axis would be the company name. 

    • Senior Director of Product
    • Ian_Macdonald
    • 4 mths ago
    • Reported - view

    Hi  ,

    Do you have some sample data we can work with to try and achieve this? 

    Thanks,

    Ian

      • Cindy_Tran
      • 4 mths ago
      • Reported - view

       I don't have a sample data that I can share but I can give the general gist of how the data I'm trying to use is formatted. 

      So the data is showing years a company is in business so the dimensions would be the year and the measure is the company name. 

      Ex. 

      Year                                                   Company 

      2019                                                  Company 1

      2020                                                  Company 1, Company 2

      2021                                                  Company 1, Company 2, Company 3

      2022                                                  Company 2, Company 3

      2023                                                  Company 3

      2024                                                  Company 4

       

      This shows that Company 1 was in business from 2019-2021, Company 2 from 2020-2021 and so on. I wanted to see if I can try to display this type of information as a line graph instead. 

      • Lead Consultant Advanced Analytics
      • Michael_Daun
      • 4 mths ago
      • Reported - view

      and  , I played around with this question yesterday and adapted my scribbles to Cindy's data now...

      I think, problems arise with the non-numeric measure ("Company Name") you created. I assume that a line graph cannot deal with it. Therefore, I created a more matrix-like data representation with a fixed numeric value for each Company. In order to obtain a reasonable order, I have chosen the value 4 for company 1, value 3 for company 2 and so on up to value 1 for company 4.I have chosen the value 4 for company 1, value 3 for company 2 and so on up to value 1 for company 4.

      With such a data set, it should also be possible to create a line chart in Pyramid! Of course, we now have numerical values on the Y-axis - but this is something you should easily find a solution for.

      Best regards,
      Michael

    • Senior Director of Product
    • Ian_Macdonald
    • 4 mths ago
    • Reported - view

    Hi  , 

    One has to ask what is the objective of the visualisation? I would assume you want to easily see and compare the companies' active life. In that case Michael's first graphic would seem to work best.

    This very easily achieved using Pyramid's normal matrix grid with some formatting added. Simply place the Company Name on rows and Year on Columns and Company Name into the Background Color Drop Zone. With some formatting of the grid you can achieve this:

    I personally think this is clearer and more useful than a line chart and requires no coding whatsoever, just drag and drop and some format tweaking.

    Hope that helps!

    Ian

      • Lead Consultant Advanced Analytics
      • Michael_Daun
      • 4 mths ago
      • Reported - view

      how does the corresponding grid looks like? So, what makes the blue bar go from 2015 to 2020?

      THANKS & regards,
      Michael

      • Senior Director of Product
      • Ian_Macdonald
      • 4 mths ago
      • Reported - view

       

      That is the grid.

      I have no measures in the grid at all. I'm using Company Name to define the background color. This will color the background where the company exists for any given year. Where there is no data for a combination of company / year, the grid cell will be blank, as that combination of values does not exist.

      Hope that helps!

      Ian

      • Lead Consultant Advanced Analytics
      • Michael_Daun
      • 4 mths ago
      • Reported - view

      - understood, but how do the bars "know" that a company exists for a given year and does not exist for another year? As there are no values - is it kind of hard coded in the color logic?

      • Senior Director of Product
      • Ian_Macdonald
      • 4 mths ago
      • Reported - view

       

      It's a function of the query / semantic model driven by the data.  I.e. There are rows in the underlying data table that contain both Company A and 2015, but no rows in the underlying data for Company A and 2021. Therefore A/2015 exists whereas A/2021 does not, hence we get color for A'2015 but nothing for A/2021.

      Hope that helps!

      Ian

    • Cindy_Tran
    • 4 mths ago
    • Reported - view

    Okay I'll try your suggestions and see how they look. thanks

Content aside

  • Status Answered
  • 1 Likes
  • 4 mths agoLast active
  • 10Replies
  • 52Views
  • 3 Following