Exemplo n.º 1
0
 override internal void  assignValues(DataProcessor dproc)
 {
     double[] parentValues = parent.getValues();
     double[] procValues   = dproc.getValues(srcName);
     values = new double[procValues.Length];
     for (int i = 0; i < values.Length; i++)
     {
         values[i] = parentValues[i] + procValues[i];
     }
 }
Exemplo n.º 2
0
        private void drawData()
        {
            worker.setAntiAliasing(gdef.antiAliasing);
            worker.clip(im.xorigin + 1, im.yorigin - gdef.height - 1, gdef.width - 1, gdef.height + 2);
            double areazero = mapper.ytr((im.minval > 0.0) ? im.minval : (im.maxval < 0.0) ? im.maxval : 0.0);

            double[] x = xtr(dproc.getTimestamps()), lastY = null;
            // draw line, area and stack
            foreach (PlotElement plotElement in gdef.plotElements)
            {
                if (plotElement.GetType() == typeof(Line) ||
                    plotElement.GetType() == typeof(Area) ||
                    plotElement.GetType() == typeof(Stack))
                {
                    SourcedPlotElement source = (SourcedPlotElement)plotElement;
                    double[]           y      = ytr(source.getValues());
                    if (source.GetType() == typeof(Line))
                    {
                        worker.drawPolyline(x, y, source.color, ((Line)source).width);
                    }
                    else if (source.GetType() == typeof(Area))
                    {
                        worker.fillPolygon(x, areazero, y, source.color);
                    }
                    else if (source.GetType() == typeof(Stack))
                    {
                        Stack stack = (Stack)source;
                        float width = stack.getParentLineWidth();
                        if (width >= 0F)
                        {
                            // line
                            worker.drawPolyline(x, y, stack.color, width);
                        }
                        else
                        {
                            // area
                            worker.fillPolygon(x, lastY, y, stack.color);
                            worker.drawPolyline(x, lastY, stack.getParentColor(), 0);
                        }
                    }
                    else
                    {
                        // should not be here
                        throw new ApplicationException("Unknown plot source: " + source.GetType());
                    }
                    lastY = y;
                }
            }
            worker.reset();
            worker.setAntiAliasing(false);
        }