From a33ed22814b68c1ba026435470c6944397cc0a2f Mon Sep 17 00:00:00 2001 From: mkalyakin Date: Mon, 4 Sep 2017 12:37:24 +0300 Subject: [PATCH] Add property showVal to Chart class --- DocX/Charts/Chart.cs | 21 +++++++++++++++++++++ Examples/Program.cs | 1 + 2 files changed, 22 insertions(+) diff --git a/DocX/Charts/Chart.cs b/DocX/Charts/Chart.cs index b9844012..a6600a5a 100644 --- a/DocX/Charts/Chart.cs +++ b/DocX/Charts/Chart.cs @@ -154,6 +154,27 @@ public Boolean View3D } } + /// + /// Get or set show values for this chart + /// + public Boolean showVal { + get { + XElement parentElement = ChartXml.Element(XName.Get("dLbls", DocX.c.NamespaceName)); + XElement element = parentElement.Element(XName.Get("showVal", DocX.c.NamespaceName)); + return(element.GetAttribute("val") == "1"); + } + set { + XElement parentElement = ChartXml.Element(XName.Get("dLbls", DocX.c.NamespaceName)); + XElement element = parentElement.Element(XName.Get("showVal", DocX.c.NamespaceName)); + if (value) { + element.SetAttributeValue("val", "1"); + } + else { + element.SetAttributeValue("val", "0"); + } + } + } + /// /// Specifies how blank cells shall be plotted on a chart /// diff --git a/Examples/Program.cs b/Examples/Program.cs index 2743c2c8..c07e08b2 100644 --- a/Examples/Program.cs +++ b/Examples/Program.cs @@ -120,6 +120,7 @@ private static void BarChart() BarChart c = new BarChart(); c.BarDirection = BarDirection.Column; c.BarGrouping = BarGrouping.Standard; + c.showVal = true; c.GapWidth = 400; c.AddLegend(ChartLegendPosition.Bottom, false);