class Plot extends View implements Resizable {

    protected final void init(Context context, AttributeSet attrs, int defStyle) {
        PixelUtils.init(context);
        layoutManager = new LayoutManager();
        title = new TextLabelWidget(layoutManager, new Size(25,
                SizeMode.ABSOLUTE, 100,
                SizeMode.ABSOLUTE),
                TextOrientation.HORIZONTAL);
        title.position(0, HorizontalPositioning.RELATIVE_TO_CENTER, 0,
                VerticalPositioning.ABSOLUTE_FROM_TOP, Anchor.TOP_MIDDLE);

        // initialize attr defaults:
        title.getLabelPaint().setTextSize(
                PixelUtils.spToPix(DEFAULT_TITLE_WIDGET_TEXT_SIZE_SP));

        onPreInit();
        // make sure the title widget is always the topmost widget:
        layoutManager.moveToTop(title);
        if(context != null && attrs != null) {
            loadAttrs(attrs, defStyle);
        }

        onAfterConfig();

        layoutManager.onPostInit();
        if (renderMode == RenderMode.USE_BACKGROUND_THREAD) {
            renderThread = new Thread(new Runnable() {
                @Override
                public void run() {

                    keepRunning = true;
                    while (keepRunning) {
                        isIdle = false;
                        synchronized (pingPong) {
                            Canvas c = pingPong.getCanvas();
                            renderOnCanvas(c);
                            pingPong.swap();
                        }
                        synchronized (renderSync) {
                            postInvalidate();
                            // prevent this thread from becoming an orphan
                            // after the view is destroyed
                            if (keepRunning) {
                                try {
                                    renderSync.wait();
                                } catch (InterruptedException e) {
                                    keepRunning = false;
                                }
                            }
                        }
                    }
                    pingPong.recycle();
                }
            }, "Androidplot renderThread");
        }
    }

    public  Plot(Context context, String title);
    public  Plot(Context context, String title, RenderMode mode);
    public  Plot(Context context, AttributeSet attrs);
    public  Plot(Context context, AttributeSet attrs, int defStyle);

}