none
What is the correct method for inverting a DataVisualization.Charting.LineSeries graph? RRS feed

  • Question

  • When using DataVisualization.Charting what is the correct method for inverting a lineseries graph so that 0 is at top. I am able to transform the chart and the line series appear correct but the legend text is inverted. In debug "Live Property Explorer", "OrientedPanel" is in the chart with "isReversed" and "isInverted" available. I can use these to get the desired results but as this panel is generated by the DataVisualization.Charting library I cannot find a way to access this property in xaml or code.



    Monday, October 7, 2019 6:15 PM

All replies

  • Hi dlrinpc,

    I am a little confused by the statement of your question, such as the statement of the title of the question, can you state clearly what kind of effect is achieved by inverting? Is your project a separate WPF program? Or WPF project host WinForm? To give a more accurate analysis, could you provide a simple demo(Don’t include any private info) to understand and analyze your question?

    Best regards

    Daisy  Tian


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, October 9, 2019 1:15 AM
  • I have a wpf mvvm project built in Visual Studio 2019. I have a LineSeries chart using DataVisualization.Charting. The bindings and view works great, but the chart needs to have 0 at the top of the Y axis legend. I can use transform to change all except for the Y LinearAxis legend. I have not been able to transform this container so the text reads correctly in the top down order required. Visual Studios shows a property in Live Property Editor that inverts the chart when set by Boolean but I have not be able to access this property in code.

    Tried to include an image of the upside down text, but cannot include image.

    <ctk:Chart x:Name="mychart" RenderTransformOrigin="0.5,0.5" >
     <ctk:Chart.RenderTransform>
      <TransformGroup>
       <ScaleTransform ScaleY="-1" ScaleX="1"/>
      </TransformGroup>
     </ctk:Chart.RenderTransform>
     <ctk:Chart.LegendStyle>
      <Style TargetType="datavis:Legend">
       <Setter Property="RenderTransform">
        <Setter.Value>
         <TransformGroup>
          <ScaleTransform ScaleX="1" ScaleY="-1" />
         </TransformGroup>
        </Setter.Value>
       </Setter>
     </ctk:Chart.LegendStyle>
     <ctk:Chart.Axes>
      <ctk:LinearAxis Orientation="X" Title="xseries" ShowGridLines="True" RenderTransformOrigin="0.5,0.5">
       <ctk:LinearAxis.RenderTransform>
        <TransformGroup>
         <ScaleTransform ScaleY="-1" ScaleX="1"/>
        </TransformGroup>
       </ctk:LinearAxis.RenderTransform>
      </ctk:LinearAxis>
      <ctk:LinearAxis Orientation="Y" Title="yseries" ShowGridLines="True" RenderTransformOrigin="0.5,0.5" >
      </ctk:LinearAxis>
     </ctk:Chart.Axes>
     <ctk:LineSeries DependentValuePath="ypath" IndependentValuePath="xpath" ItemsSource="{Binding collection}" Title="serieschart" RenderTransformOrigin="0.5,0.5" /> 
    </ctk:Chart>

    Thanks

    Wednesday, October 9, 2019 4:12 PM
  • Hi dlrinpc,

    The code you provided seems to be of little help to me in understanding your problem. I have no idea about the content in namespace ctk, could you provide a simple and complete demo that can run for my better analysis?Thanks for your understanding.

    Best regards

    Daisy  Tian


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, October 10, 2019 5:52 AM
  • The namespaces used are,
    xmlns:ctk="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"

    I do not have any time available to assemble a demo. There are several demos available online using the DataVisualization.Toolkit. Any of them would work. Search for WPF DataVisualization Charting Toolkit LineSeries. The labels on the left always have the low numbers at the bottom and the higher numbers at top. I need to reverse the top down order of the labels. I am trying to keep this in xaml as a style as the chart changes continuously.

    The numbers to the left cannot be reordered and not inverted so they are readable.

    3- |-----|-----|-----|-----|-----|-----|
    2- |-----|-----|-----|-----|-----|-----|
    1- |-----|-----|-----|-----|-----|-----|
    0- |-----|-----|-----|-----|-----|-----|

    I need it to be reversed order without inverting the numbers so it looks like this

    0- |-----|-----|-----|-----|-----|-----|
    1- |-----|-----|-----|-----|-----|-----|
    2- |-----|-----|-----|-----|-----|-----|
    3- |-----|-----|-----|-----|-----|-----|

    Thanks

    Thursday, October 10, 2019 4:15 PM
  •     
    Hi   dlrinpc,  

    At, present, We haven't found a way to meet your needs. I suggest you can try to refer to some open source chart control to realize.

    Best regards

    Yong Lu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, October 22, 2019 7:40 AM
    Moderator