Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
jazfunk
Frequent Visitor

Modify Axis Values for Letter Grade Category

I've modified the Microsoft Bullet Chart to have additional bars, and some other necessary customizations.  So far, I've been successful.  

 

The trouble I'm having now is attempting to display letter values on the axis.  I have only one record in my dataset which I'm attempting to convert numbers (1-10) to their letter grade equivalent (A+, A, A-, B+, B, B-, C+, C, C-, D).  

 

I've modified the visual to convert the numbers to the letters using a JSON object, and it shows in the "Value" in the tooltip, and below the category name where I've manually added the text.  However, the Axis still displays the numbers 1-10.  

 

Which approach should I take to get the axis to display letters as needed?  I've looked at creating an ordinal scale (couldn't get that to work), and now I'm looking into modifying the axis after the DOM is rendered (with no success, yet).

 

The visual has a level of complexity where it's not very intuitive to make this modification, at least at my current level of proficiency with D3.

 

Thanks for any input.

1 ACCEPTED SOLUTION
jazfunk
Frequent Visitor

@V-lianl-msft You're correct in that it was difficult, and took me quite a while to come up with a solution... but I did last night.

 

I was able to capture the axis right before it was drawn. 

 

This screenshot shows the area in the setUpBulletsHorizontally() method where I instantiated the existing scale, built a new axis, set the tickValues() and tickFormat() methods to the letter/number grade conversion values, then assigned it to the bar.xAxisProperties object if the existing current bar/bullet *resultValue in the loop was non-numeric.  

 
*Note:  The "resultValue" property is a custom property I added to the BulletChartModel BarData interface.
 
Worked like a charm!
 
jazfunk_0-1625145734250.png

 

View solution in original post

2 REPLIES 2
jazfunk
Frequent Visitor

@V-lianl-msft You're correct in that it was difficult, and took me quite a while to come up with a solution... but I did last night.

 

I was able to capture the axis right before it was drawn. 

 

This screenshot shows the area in the setUpBulletsHorizontally() method where I instantiated the existing scale, built a new axis, set the tickValues() and tickFormat() methods to the letter/number grade conversion values, then assigned it to the bar.xAxisProperties object if the existing current bar/bullet *resultValue in the loop was non-numeric.  

 
*Note:  The "resultValue" property is a custom property I added to the BulletChartModel BarData interface.
 
Worked like a charm!
 
jazfunk_0-1625145734250.png

 

V-lianl-msft
Community Support
Community Support

I think it will be very complicated to do so. It is difficult to define the length between letter grade and the number range of letter grade . We also need to consider the order of letter grade.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.