Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Creating a mekko or mosaic chart
Forum Updated to NodeBB v4.3 + New Features

Creating a mekko or mosaic chart

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 829 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sunilqtS Offline
    sunilqtS Offline
    sunilqt
    wrote on last edited by
    #1

    A mekko or mosaic chart is a form of stacked bar chart with variable width bars. The width of the bar indicates the relative sizes of each of the items on the x-axis; the individual pieces of the bar represent the breakdown within that segment, adding up to 100% (see example below).

    Is it possible to create variable width columns in Qt Charts? Would you inherit from stacked bar chart? Any suggestions appreciated.

    Sunil

    0_1513353572091_39c41d87-e6d4-4aaa-a577-d16bf1d0e354-image.png

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      It sounds to me that all bars are same width
      https://doc.qt.io/archives/qt-5.7/qabstractbarseries.html#barWidth-prop
      But there might exists some method to set it that i dont know of.

      Do you need zooming and selection and that stuff ?
      Otherwise just drawing it yourself would not be huge tasks.

      1 Reply Last reply
      0
      • sunilqtS Offline
        sunilqtS Offline
        sunilqt
        wrote on last edited by
        #3

        From what I could tell looking at the docs, there is no way to have a separate width for each bar. Yes, I can create the whole thing from scratch, but I would like to take advantage of the work that others have already done and have a reproducible structure instead of a one off.

        mrjjM 1 Reply Last reply
        0
        • sunilqtS sunilqt

          From what I could tell looking at the docs, there is no way to have a separate width for each bar. Yes, I can create the whole thing from scratch, but I would like to take advantage of the work that others have already done and have a reproducible structure instead of a one off.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @sunilqt
          Agree, if you are using other Charts it would be better to reuse as much as possible.

          One thing i saw in docs.
          "Sets the width of the bars of the series. "

          So i wondered if one can have multiple series in one chart as that would mean
          each series can have own width. so if one bar pr series maybe that way
          one can have varying widths.

          Looking at QStackedBarSeries / QAbstractBarSeries im not sure its possible to subclass and override
          so barWidth can return different values.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved