Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to do aligned scrolling through two chart areas without using AlignToChartArea?
    primarykey
    data
    text
    <p>I have two <code>ChartArea</code> objects in a <code>Chart</code> (<code>System.Windows.Forms.DataVisualization.Charting</code> is what I'm using).</p> <p>One is a Point graph, and the other is a RangeBar graph. The horizontal axis on the RangeBar graph is actually the Y axis, so I <em>cannot</em> just use something like this:</p> <pre><code>Chart1.ChartAreas["Chart Area 2"].AlignWithChartArea = "Default"; </code></pre> <p>I've figured out how to zoom both charts and keep them aligned, but when I try to scroll both charts by clicking on the scrollbar on one of the horizontal axes, I can't quite get it to line up. They <em>almost</em> line up, but they're off by maybe a second or so (the horizontal axis in both graphs is time).</p> <p>Here's what I have:</p> <pre><code>private void theChart_AxisViewChanged(object sender, ViewEventArgs e) { if (e.ChartArea == theChart.ChartAreas["MyPointChartArea"]) { theChart.ChartAreas["MyRangeBarChartArea"].AxisY.ScaleView.Position = e.NewPosition; theChart.ChartAreas["MyRangeBarChartArea"].AxisY.ScaleView.Size = e.NewSize; theChart.ChartAreas["MyRangeBarChartArea"].AxisY.ScaleView.SizeType = e.NewSizeType; } if (e.ChartArea == theChart.ChartAreas["MyRangeBarChartArea"]) { theChart.ChartAreas["MyPointChartArea"].AxisX.ScaleView.Position = e.NewPosition; theChart.ChartAreas["MyPointChartArea"].AxisX.ScaleView.Size = e.NewSize; theChart.ChartAreas["MyPointChartArea"].AxisX.ScaleView.SizeType = e.NewSizeType; } } </code></pre> <p>What else do I need to do to get the charts to line up? The physical extent of the charts is the same. It's just the data that are slightly misaligned.</p> <p>Thanks for any help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload