Skip to content

Commit

Permalink
Use generic parent type 'VisualizationDataSpec' to fix parsing errors…
Browse files Browse the repository at this point in the history
… with some dashboards
  • Loading branch information
srodriguezinfragistics committed Nov 28, 2024
1 parent 6ab6e69 commit 7df0adc
Showing 1 changed file with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,38 @@ public abstract class SingleValueLabelsVisualizationBase<TSettings> : Visualizat
protected SingleValueLabelsVisualizationBase(string title, DataSourceItem dataSourceItem) : base(title, dataSourceItem) { }

[JsonIgnore]
public List<DimensionColumn> Labels { get { return VisualizationDataSpec.Rows; } }
public List<DimensionColumn> Labels {
get
{
if (VisualizationDataSpec is SingleValueLabelsVisualizationDataSpec vizSpec)
{
return vizSpec.Rows;
}
else
{
return new List<DimensionColumn>();
}
}
}

[JsonIgnore]
public List<MeasureColumn> Values { get { return VisualizationDataSpec.Value; } }
public List<MeasureColumn> Values {
get
{
if (VisualizationDataSpec is SingleValueLabelsVisualizationDataSpec vizSpec)
{
return vizSpec.Value;
}
else
{
return new List<MeasureColumn>();
}
}
}


//Some visualizations can be assigned a CategoryVisualizationDataSpec instead of a SingleValueLabelsVisualizationDataSpec
[JsonProperty(Order = 7)]
SingleValueLabelsVisualizationDataSpec VisualizationDataSpec { get; set; } = new SingleValueLabelsVisualizationDataSpec();
VisualizationDataSpec VisualizationDataSpec { get; set; } = new SingleValueLabelsVisualizationDataSpec();
}
}

0 comments on commit 7df0adc

Please sign in to comment.