ZEISS-PiWeb / PiWeb-Formplots

An API to read and write plot data for the ZEISS PiWeb quality data management system
https://www.zeiss.com/metrology/products/software/piweb.html
BSD 3-Clause "New" or "Revised" License
2 stars 4 forks source link

Autoscaling Line Plots #1

Closed philippMayinger closed 6 years ago

philippMayinger commented 6 years ago

I've created a simple line plot following more or less the sample code:

` var splot = new StraightnessPlot(); var lpoints = new List();

                    //fill the point array
                    for (int i = 0; i < 100; i++)
                    {
                        lpoints.Add(new LinePoint(
                            //segment
                            new Segment("defaultSegment", SegmentTypes.None),
                            //position
                            x[i],
                            //deviation
                            y[i]
                            ));
                    }

                    //set parameters
                    splot.Actual.Length = 1;

                    //add points to plot
                    splot.Points = lpoints;

                    //write plot 
                    splot.WriteTo(stream);
                    rawDataClient.CreateRawData(new RawDataInformation
                    {
                        FileName = "Plot.pltx",
                        MimeType = "application/x-zeiss-piweb-formplot",
                        Key = -1,
                        Created = DateTime.Now,
                        LastModified = DateTime.Now,
                        MD5 = new Guid(System.Security.Cryptography.MD5.Create().ComputeHash(stream.ToArray())),
                        Size = stream.ToArray().Count(),
                        Target = CharacteristicUuid
                    }, stream.ToArray()).Wait();

`

This creates formplot data. However, the plot does not look as expected because the x axis does not scale correctly.

Which propety sets the x axis scale?

capture

Schnjan commented 6 years ago

Taken from the documentation:

The plot axis can be modified with the actual geometry parameters Length and Position. The Length parameter will be multiplied to the points position range to determine the value range of the plot, while the Position parameter is added as an offset. The plots ProjectionAxis determines, which coordinate of the Position is used as offset.

But

You have a different issue. Your deviations are extremely large, which makes the plot unable to render correctly. Remember: this is not a mathematical function plotter! Try multiplying your deviations with 0.01 and have a look

philippMayinger commented 6 years ago

Thanks a lot. Now it's working fine after reducing my deviation by the factor of 100.

Is there any statement about how big the deviation is allowed to be compared to the position?

Schnjan commented 6 years ago

It's not a fixed value:

Given your plot has a size of 20 15 cm and your projection axis has a value range of 70, then the approximate 'maximum value' is ~70 / 20 0.5 * 15. This refers to the plot area itself, as the PiWeb element also displays scales and labels which make the area even smaller.

You can create a fully functional mathematical plotter with our Plot extension API