C# Excel Chart with custom X-Axis

后端 未结 1 1661
执念已碎
执念已碎 2021-01-26 02:43

i have a chart from two columns. In Column A are some result % values and in B i have the corresponding Name to the value.

A   B   
90  Test1   
82  Test2   
66          


        
相关标签:
1条回答
  • 2021-01-26 03:21

    You will have to adapt to these settings, otherwise your xvalues will be just a count:

     chartPage.SetSourceData Range("A2:A4"), xlRows
     chartPage.SeriesCollection(1).XValues = Range("B2:B4")
    

    or

     chartPage.SetSourceData Range("A2:A4"), xlColumns
     chartPage.SeriesCollection(1).XValues = Range("B2:B4")
    

    maby there is a another way, but as a quick solution, this would work in VBA - so it should too, when you adapt it to your C# version.

    0 讨论(0)
提交回复
热议问题