diff --git a/src/Reveal.Sdk.Dom/Visualizations/SingleValueLabelsVisualizationBase.cs b/src/Reveal.Sdk.Dom/Visualizations/SingleValueLabelsVisualizationBase.cs index bfeb42fb..9bceb6c7 100644 --- a/src/Reveal.Sdk.Dom/Visualizations/SingleValueLabelsVisualizationBase.cs +++ b/src/Reveal.Sdk.Dom/Visualizations/SingleValueLabelsVisualizationBase.cs @@ -12,12 +12,38 @@ public abstract class SingleValueLabelsVisualizationBase : Visualizat protected SingleValueLabelsVisualizationBase(string title, DataSourceItem dataSourceItem) : base(title, dataSourceItem) { } [JsonIgnore] - public List Labels { get { return VisualizationDataSpec.Rows; } } + public List Labels { + get + { + if (VisualizationDataSpec is SingleValueLabelsVisualizationDataSpec vizSpec) + { + return vizSpec.Rows; + } + else + { + return new List(); + } + } + } [JsonIgnore] - public List Values { get { return VisualizationDataSpec.Value; } } + public List Values { + get + { + if (VisualizationDataSpec is SingleValueLabelsVisualizationDataSpec vizSpec) + { + return vizSpec.Value; + } + else + { + return new List(); + } + } + } + + //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(); } } \ No newline at end of file