我有两个问题。如何使用代码隐藏构建要在堆积柱形图中输出的 XML 文件?其次,如何将其放入 vb 的代码隐藏中?
这是目前的代码隐藏:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Chart1.Width = 200
Chart1.Height = 300
Dim XMLFile As XElement = XElement.Load(Server.MapPath("~/xml/XMLFile.xml"))
Chart1.Series(0).ChartType = DataVisualization.Charting.SeriesChartType.StackedColumn
Chart1.Series(0).Palette = DataVisualization.Charting.ChartColorPalette.BrightPastel
Chart1.Series("Series1").IsValueShownAsLabel = True
For Each node As XElement In XMLFile.Elements("something")
Dim string1 As String = node.Element("whatever1").Value
Dim string2 As String = node.Element("whatever2").Value
Chart1.Series("Series1").Points.AddXY(string1, string2)
Chart1.ChartAreas("ChartArea1").Area3DStyle.Enable3D = True
Chart1.ChartAreas("ChartArea1").Area3DStyle.Inclination = 15
Chart1.ChartAreas("ChartArea1").Area3DStyle.Rotation = 15
Next
End Sub
XMLFile 目前看起来像这样:
<root>
<something>
<whatever1>One</whatever1>
<whatever2>1</whatever2>
</something>
<something>
<whatever1>Two</whatever1>
<whatever2>2</whatever2>
</something>
</root>
我需要两列,每列中堆叠三个不同的值。我怎么做?