@@ -3,7 +3,7 @@ import ILocalizationManager = powerbi.extensibility.ILocalizationManager;
33
44import { formattingSettings } from "powerbi-visuals-utils-formattingmodel" ;
55import { legendInterfaces } from "powerbi-visuals-utils-chartutils" ;
6- import { DataOrder , DataOffset } from "./utils" ;
6+ import { DataOrder , DataOffset , LabelOrientationMode } from "./utils" ;
77import { StreamGraphSeries } from "./dataInterfaces" ;
88import LegendPosition = legendInterfaces . LegendPosition ;
99
@@ -31,6 +31,11 @@ const dataOffsetOptions : IEnumMemberWithDisplayNameKey[] = [
3131 { value : DataOffset [ DataOffset . Expand ] , displayName : "Expand" , key : "Visual_DataOffset_Expand" }
3232] ;
3333
34+ const labelOrientationModeOptions : IEnumMemberWithDisplayNameKey [ ] = [
35+ { value : LabelOrientationMode [ LabelOrientationMode . Default ] , displayName : "Default (Auto)" , key : "Visual_LabelOrientation_Default" } ,
36+ { value : LabelOrientationMode [ LabelOrientationMode . ForceRotate ] , displayName : "Force Rotate" , key : "Visual_LabelOrientation_ForceRotate" }
37+ ] ;
38+
3439export class BaseFontCardSettings extends Card {
3540 public fontFamily : formattingSettings . FontPicker ;
3641 public fontSize : formattingSettings . NumUpDown ;
@@ -59,7 +64,7 @@ export class BaseFontCardSettings extends Card {
5964 } ,
6065 maxValue : {
6166 type : powerbi . visuals . ValidatorType . Max ,
62- value : 60 ,
67+ value : 30 ,
6368 }
6469 }
6570 } ) ;
@@ -114,14 +119,19 @@ class AxisTitleGroup extends BaseFontCardSettings {
114119}
115120
116121class AxisOptionsGroup extends BaseFontCardSettings {
117- constructor ( settingName : string , useHighPrecision : boolean = false ) {
122+ constructor ( settingName : string , useHighPrecision : boolean = false , showLabelOrientation : boolean = false ) {
118123 super ( ) ;
119124
120125 this . name = `optionsGroup${ settingName } ` ;
121126 this . displayNameKey = `Visual_Values` ;
122127 this . topLevelSlice = this . show ;
123128
124- this . slices = [ ...( useHighPrecision ? [ this . highPrecision ] : [ ] ) , this . font , this . labelColor ] ;
129+ this . slices = [
130+ ...( useHighPrecision ? [ this . highPrecision ] : [ ] ) ,
131+ this . font ,
132+ this . labelColor ,
133+ ...( showLabelOrientation ? [ this . labelOrientationMode ] : [ ] )
134+ ] ;
125135 }
126136
127137 public show = new formattingSettings . ToggleSwitch ( {
@@ -144,6 +154,14 @@ class AxisOptionsGroup extends BaseFontCardSettings {
144154 displayNameKey : "Visual_HighPrecision" ,
145155 value : false ,
146156 } ) ;
157+
158+ public labelOrientationMode = new formattingSettings . ItemDropdown ( {
159+ items : labelOrientationModeOptions ,
160+ value : labelOrientationModeOptions [ 0 ] ,
161+ displayName : "Label Orientation" ,
162+ displayNameKey : "Visual_LabelOrientation" ,
163+ name : "labelOrientationMode"
164+ } ) ;
147165}
148166
149167export class GeneralCardSettings extends Card {
@@ -184,13 +202,13 @@ export class BaseAxisCardSettings extends CompositeCard {
184202 public options : AxisOptionsGroup ;
185203 public groups : Group [ ] ;
186204
187- constructor ( name : string , displayNameKey : string , useHighPrecision : boolean = false ) {
205+ constructor ( name : string , displayNameKey : string , useHighPrecision : boolean = false , showLabelOrientation : boolean = false ) {
188206 super ( ) ;
189207
190208 this . name = name ;
191209 this . displayNameKey = displayNameKey ;
192210 this . title = new AxisTitleGroup ( name ) ;
193- this . options = new AxisOptionsGroup ( name , useHighPrecision ) ;
211+ this . options = new AxisOptionsGroup ( name , useHighPrecision , showLabelOrientation ) ;
194212 this . groups = [ this . options , this . title ] ;
195213 }
196214}
@@ -360,7 +378,7 @@ export class StreamCardSettings extends CompositeCard {
360378
361379export class StreamGraphSettingsModel extends Model {
362380 general = new GeneralCardSettings ( ) ;
363- categoryAxis = new BaseAxisCardSettings ( "categoryAxis" , "Visual_XAxis" ) ;
381+ categoryAxis = new BaseAxisCardSettings ( "categoryAxis" , "Visual_XAxis" , false , true ) ;
364382 valueAxis = new BaseAxisCardSettings ( "valueAxis" , "Visual_YAxis" , true ) ;
365383 legend = new LegendCardSettings ( ) ;
366384 dataLabels = new DataLabelsCardSettings ( ) ;
@@ -379,6 +397,7 @@ export class StreamGraphSettingsModel extends Model {
379397 public setLocalizedOptions ( localizationManager : ILocalizationManager ) {
380398 this . setLocalizedDisplayName ( dataOrderOptions , localizationManager ) ;
381399 this . setLocalizedDisplayName ( dataOffsetOptions , localizationManager ) ;
400+ this . setLocalizedDisplayName ( labelOrientationModeOptions , localizationManager ) ;
382401 }
383402
384403 private setLocalizedDisplayName ( options : IEnumMemberWithDisplayNameKey [ ] , localizationManager : ILocalizationManager ) {
0 commit comments