This project is read-only.

Disproportionate X and Y axis

Oct 20, 2010 at 1:46 PM

I am trying to create a chart with X and Y axis that are both measured in feet but are disproportionate to each other.  I apply a factor to the X for DataToViewport and ViewportToData functions and the data presents correctly but the X axis is reduced by the same factor.  Is there a way to customize the appearance of the ticks on the X axis?  Here is what I have.

ObservableDataSource<Point> surveyPoints = new ObservableDataSource<Point>(
                interpolatedSurveys.Select(s => new Point
                    X = (double)s.VerticalSection,
                    Y = (double)s.TotalVerticalDepth

            double M, B; // y = M * x + B

            Get_M_and_B(yMin, yMax, out M, out B);

            double xScaleFactor = xMax / yMax;

            Func<double, double> ConvertToDouble = s => -(M * s + B);
            Func<double, double> ConvertFromDouble = t => -((t - B) / M);       
            Func<Point, Point> DataToViewport = s => new Point((s.X * xScaleFactor), ConvertToDouble(s.Y));
            Func<Point, Point> ViewportToData = t => new Point((t.X * xScaleFactor), ConvertFromDouble(t.Y));

            LineGraph graph = plotter.AddLineGraph(surveyPoints, Colors.Blue);
            graph.DataTransform = new LambdaDataTransform(DataToViewport, ViewportToData);            

            ((VerticalAxis)plotter.MainVerticalAxis).ConvertFromDouble = ConvertFromDouble;
            ((VerticalAxis)plotter.MainVerticalAxis).ConvertToDouble = ConvertToDouble;    

Oct 20, 2010 at 7:48 PM

I have discovered what I really need is to show all of the X axis regardless of how much data will be presented along X.  Is there a way to show say 10,000 on the X even though the data may only reach 130?

Oct 21, 2010 at 10:03 PM

What range do you want the X-Axis to display?   0 -> 10,000?


Chart.Viewport.Visible = new DataRect(0, Chart.Viewport.Visible.YMin, 10000, Chart.Viewport.Visible.Height );

Oct 21, 2010 at 11:15 PM

Thanks.  That solves a problem we have been trying to figure out for a while.  I wouldn't have thought to look at the Visible property.  That made me think more in terms of hide or show, not a viewable area.  Thanks again.

Nov 7, 2010 at 9:17 AM


My name is Mikhail Brinchuk, and I am a developer of DynamicDataDisplay.

I'm searching now a remote job, so if you or your company can offer it to me, I will be very grateful.

If you want to customize DynamicDataDisplay somehow, I can help you to do it.

My CV is here -

Best regards,