Data Colors by Category setting does not stick

Issue #93 new
Thomas William Jude created an issue

I have the following scenario.

  1. Measure data … filtered using two related slicers
  2. Category … uses an independent dimension

It is observed that when I set the Data Colors by Category for the chart, the values are stored for the current selection of the slicers.

When I select another value in the slicer, the colors revert back to Default. Note: The Transparency does not revert to Default.

Now, if I set the colors again with the current slicer selection, it will work for both, but not the rest.

Comments (5)

  1. Thomas William Jude reporter

    Having looked at the properties in the Layout file, I think I found the issue.

    The issue is that for categoryFillColour , the expression to compare uses the current “Sampling” value instead of “Category” value.

    In my case, when I change selection in the slicers, the first value of the “Sampling” which was stored is filtered out and therefore color resets to Default.

  2. Daniel Marsh-Patrick repo owner

    Hi, Thomas, and thanks very much for the report. Given the nature of the issue, I’m amazed that no-one has reported this to date.

    I’ve spent some time thinking about the problem and the challenge with this is around the approach taken to optimise the amount of data points we can use, as well as the performance of the data view we get in the visual from Power BI. Normally with data-bound properties, we’d just carve off a data role, such as category in this case into a group in the visual’s dataViewMapping, and then we have no dependencies on the granularity. It’s really easy to create a selection ID for the category value and store it for subsequent retrieval.

    This works fine for visuals with a small number of data points but having observed the negative performance impacts on other distribution-based custom visuals that used this approach, as well as doing some individual profiling myself, I made the decision to go with the current implementation. This is clearly not ‘category safe’ if the data returned by Power BI changes whilst using the visual and is kind of a big deal, usability-wise.

    However, if we fix this and there are a number of categories, the resulting data view provided by Power BI (particularly if a unique sampling value is used for every data point) will contain objects that are padded with as many null values as required to keep the sampling x grouping consistent, and this results in some significant memory pressure on the client.

    I think that to adequately resolve this, I’ll need to look at re-implementing the data view mapping and see if I can create a happy medium between the two. This will have knock-on effects on the rest of the visual’s ViewModel and rendering logic, so is certainly not a trivial change. As I develop my visuals in my free time, I don’t think I can provide an ETA on when I could have a solution available.

  3. Thomas William Jude reporter

    Thanks Daniel for the detailed explanation. Having gone through your comments in the source code, I understood the reasons for the implementation & issues involved. I was trying to use the visual for a client and had time constraints. I settled for a workaround i.e. use a separate instance of the visual for each category. Though not ideal, it was ok in my case as I had only 3 categories.The only issue is that each of the visuals will scale differently. eg. if we wanted to show Target Vs Actuals ... if it was in one visual both would have been plotted against the same y-axis and therefore allows for an easy inter-category visual-comparison as well.

    Regarding the solution: You may consider a sub property "Category Limit" with a default ( say 10 ) and a warning that higher numbers may impact performance. Also an additional checkbox - "Add remaining to Category Others".

    ... always take the TopN categories and include everything else in the single category "Others" if the checkbox is ticked.

  4. Samantha Thomas

    Hi Daniel,

    Just wanted to bump this. I have a similar issue with a report where the category colours drop out whenever the underlying data is updated, even though the categories and filters aren’t changing, it’s just more up to date data. I appreciate it’s not a quick fix, but would be massively helpful once it’s sorted!

    I’m as surprised as you are that no-one had mentioned it before, it became very apparent to me shortly after I started using the visual.

    Really appreciate the work you have done on this, it’s a very helpful visual to have, and it’s very user-friendly.

  5. Log in to comment