Vega Bar Chart Example + Magic! = IBCS-Styled Chart for Power BI

Поділитися
Вставка
  • Опубліковано 15 жов 2024

КОМЕНТАРІ • 6

  • @totvabe1
    @totvabe1 8 місяців тому +1

    I don't quite understand why we use in the mark of the labels the data source
    "from": {"data": "rect-ac"},
    if then the fields we are going to use "month" and "ac" are also present in the original table
    "from": {"data": "table"},
    But the truth is that I'm testing it and it doesn't work...
    I would understand it better if we were to use a transformation of the original data that we had done in "data": "rect-ac", but we haven't done it.

    • @power-of-bi
      @power-of-bi  8 місяців тому +1

      Thanks. Really great question. Well, there is no a single way to create a visualization. It's perfectly OK to use the same data source for the rectangles and for the text labels. And in many cases there will be no meaningful difference. In this example you can replace {"data": "rect-ac"} with {"data": "table"} and then remove 'datum.' from the "field" properties within "encode", because as you have mentioned we don't use fields generated by Vega for the "rect-ac" table (such as xc, y, width, height), we still use the original "table" fields stored in the datum field of the 'rect-ac' table.
      Or you can keep {"data": "rect-ac"}, remove the "scale" and "band" properties and use "field: "x" instead of "field": "datum.month", "field": "y" instead of "field": "datum.AC" and "field": "datum.AC" for the "text". In more advanced visualizations using a table like "rect-ac" (a table created by adding "name" property to a mark) will be useful to avoid repeating some heavy calculations multiple times (assuming there was some tricky formula to calculate "x", "y", "width", "height", "fill" or any other property of one mark (such as "rect-ac") and you need the same for the other mark (such as "text" for the text label) .
      In this case it doesn't really matter. Whatever piece of code was easier to copy paste from the previously created marks and modify.
      Thanks again. I'll talk about this in the future videos.

    • @totvabe1
      @totvabe1 8 місяців тому +1

      Thank you very much for your clarification, Andrzej! These step-by-step videos with detailed explanations are very helpful.

  • @kasunmanchanayake5550
    @kasunmanchanayake5550 8 місяців тому

    How can we embed this into Deneb

    • @power-of-bi
      @power-of-bi  8 місяців тому

      This will be a subject of the next video. Thanks.

    • @power-of-bi
      @power-of-bi  8 місяців тому

      ua-cam.com/video/oun2V09Dbt8/v-deo.html