Beispiel #1
0
        public void initFibonaccie(ChartBase mainChart, Font f, Share share)
        {
            setChart(mainChart);
            mShare = share;
            mFont  = f;

            mChart.clearModifyKey();

            loadFibonaccie();
        }
        public void setChart(int chartIdx)
        {
            ChartBase c = createSubChart(chartIdx);

            if (c != null)
            {
                mChartIdx = chartIdx;
                c.setSize(getW(), getH());
                setChart(c);
            }
        }
Beispiel #3
0
        public void setSecondChart(ChartBase c)
        {
            c.setSize(this);

            mCharts[1] = c;
        }
Beispiel #4
0
        public void setFirstChart(ChartBase c)
        {
            c.setSize(this);

            mCharts[0] = c;
        }
 public void setChartMaster(ChartBase chartMaster)
 {
     mChartMaster = chartMaster;
 }
        ChartBase createSubChart(int chartID)
        {
            ChartBase c = null;
            Font      f = Context.getInstance().getFontSmall();

            if (chartID == ChartBase.CHART_THUYPS)
            {
                c = new ChartLine(f);
                c.setChartType(ChartBase.CHART_THUYPS);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_TRIX)
            {
                c = new ChartLine(f);
                c.setChartType(ChartBase.CHART_TRIX);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_OBV)
            {
                c = new ChartOBV(f);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_MACD)
            {
                c = new ChartMACD(f);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_MCDX)
            {
                c = new ChartMCDX(f);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_MFI)
            {
                c = new ChartLine(f);
                c.setChartType(ChartLine.CHART_MFI);    //  ChartLine.CHART_THUYPS);//
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_RSI)
            {
                c = new ChartLine(f);
                c.setChartType(ChartLine.CHART_RSI);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_ADX)
            {
                c = new ChartADX(f);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_STOCHASTIC_FAST)
            {
                c = new ChartStochastic(f, true);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_STOCHASTIC_SLOW)
            {
                c = new ChartStochastic(f, false);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_ADL)
            {
                c = new ChartLine(f);
                c.setChartType(ChartBase.CHART_ADL);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_CHAIKIN)
            {
                c = new ChartLine(f);
                c.setChartType(ChartBase.CHART_CHAIKIN);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_ROC)
            {
                c = new ChartLine(f);
                c.setChartType(ChartBase.CHART_ROC);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_STOCHRSI)
            {
                c = new ChartStochRSI(f);
                c.setChartType(ChartBase.CHART_STOCHRSI);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_WILLIAMR)
            {
                c = new ChartWilliamR(f);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_NVI)
            {
                c = new ChartLine(f);
                c.setChartType(ChartBase.CHART_NVI);
                c.mShouldDrawCursor = true;
            }
            if (chartID == ChartBase.CHART_PVI)
            {
                c = new ChartLine(f);
                c.setChartType(ChartBase.CHART_PVI);
                c.mShouldDrawCursor = true;
            }
            else if (chartID == ChartBase.CHART_PVT)
            {
                c = new ChartLine(f);
                c.setChartType(ChartBase.CHART_PVT);
                c.mShouldDrawCursor = true;
            }
            else if (chartID == ChartBase.CHART_CCI)
            {
                c = new ChartLine(f);
                c.setChartType(ChartBase.CHART_CCI);
                c.mShouldDrawCursor = true;
            }
            else if (chartID == ChartBase.CHART_MASSINDEX)
            {
                c = new ChartLine(f);
                c.setChartType(ChartBase.CHART_MASSINDEX);
                c.mShouldDrawCursor = true;
            }
            else if (chartID == ChartBase.CHART_AROON)
            {
                c = new ChartAroon(f, ChartBase.CHART_AROON);
                c.setChartType(ChartBase.CHART_AROON);
                c.mShouldDrawCursor = true;
            }
            else if (chartID == ChartBase.CHART_AROON_OSCILLATOR)
            {
                c = new ChartAroon(f, ChartBase.CHART_AROON_OSCILLATOR);
                c.setChartType(ChartBase.CHART_AROON_OSCILLATOR);
                c.mShouldDrawCursor = true;
            }
            else if (chartID == ChartBase.CHART_CFM)
            {
                c = new ChartCFM(f);
                c.setChartType(ChartBase.CHART_CFM);
                c.mShouldDrawCursor = true;
            }
            else if (chartID == ChartBase.CHART_ATR)
            {
                c = new ChartLine(f);
                c.setChartType(ChartBase.CHART_ATR);
                c.mShouldDrawCursor = true;
            }
            else if (chartID == ChartBase.CHART_CRS_RATIO)
            {
                c = new ChartComparativeRS(chartID, f);
                ((ChartComparativeRS)c).setBaseSymbol("^VNINDEX", 5, 20);
                c.mShouldDrawCursor = true;
            }
            else if (chartID == ChartBase.CHART_COMPARING_SECOND_SHARE)
            {
                c = new ChartMasterSimple(f);
                c.setChartType(chartID);
                c.mShouldDrawCursor = true;
                ((ChartMasterSimple)c).setShareCode("^VNINDEX");
                //((ChartLine)c).compareToShare("^VNINDEX");
            }
            else if (chartID == ChartBase.CHART_CRS_PERCENT)
            {
                c = new ChartComparativeRS(chartID, f);
                ((ChartComparativeRS)c).setBaseSymbol("^VNINDEX", 5, 20);
                c.mShouldDrawCursor = true;
            }
            if (c == null)
            {
                c = new ChartVolume(f);
                c.setListener(this);
                c.mShouldDrawCursor = true;
            }

            c.setHasDrawer(true);
            c.setShare(mShare);
            c.setRefChart(mChartMaster);

            return(c);
        }
        //=================================

        public SubchartsContainer(int idx, Share share, xIEventListener listener, bool add_removable)
            : base(listener)
        {
            setID(idx);

            mShare = share;

            mCurrentChart = null;
            //mSwitchButton = null;

            mChartIdx = 0;

            if (Context.getInstance().isExpiredAccount())
            {
                int[] ids =
                {
                    -1000, //ChartBase.CHART_ADL,
                    -1000, //ChartBase.CHART_ADX,
                    -1000,
                    -1000, //ChartBase.CHART_CHAIKIN,
                    -1000,
                    ChartBase.CHART_MFI,
                    ChartBase.CHART_MACD,
                    -1000, //ChartBase.CHART_NVI,
                    -1000, //ChartBase.CHART_PVI,
                    -1000, //ChartBase.CHART_OBV,
                    -1000, //ChartBase.CHART_ROC,
                    -1000, //  PVT
                    ChartBase.CHART_RSI,
                    -1000, //ChartBase.CHART_STOCHASTIC_FAST,
                    -1000, //ChartBase.CHART_STOCHASTIC_SLOW,
                    -1000, //ChartBase.CHART_STOCHRSI,
                    -1000, //ChartBase.CHART_TRIX,
                    ChartBase.CHART_VOLUME,
                    //ChartBase.CHART_THUYPS,
                    -1,
                    C.ID_REMOVE_SUB_CHART
                };
                string[] ss =
                {
                    "******Accumulation Distribution Line (ADL)",
                    "******Average Directional Index (ADX)",
                    "******Commodity Channel Index (CCI)",
                    "******Chaikin Oscillator",
                    "******Mass Index (Mass)",
                    "Money Flow Index (MFI)",
                    "******Moving Average Convergence-Divergence (MACD)",
                    "******Negative Volume Index (NVI)",
                    "******Positive Volume Index (PVI)",
                    "******On Balance Volume (OBV)",
                    "******Rate of Change (ROC)",
                    "******Price Volume Trend",
                    "Relative Strength Index (RSI)",
                    "******Stochastic Fast",
                    "******Stochastic Slow",
                    "******StochRSI",
                    "******Triple Exponential Average (TRIX)",
                    "Volume",
                    //"ThuyPS",
                    "",
                    "Đóng đồ thị (Thêm: Ctrl + chọn đồ thị)",
                };

                int cnt = ids.Length;
                if (!add_removable)
                {
                    cnt -= 2;
                }
                setMenuContext(ids, ss, cnt);
            }
            else
            {
                int[] ids =
                {
                    ChartBase.CHART_AROON,
                    ChartBase.CHART_AROON_OSCILLATOR,
                    ChartBase.CHART_ATR,
                    ChartBase.CHART_ADL,
                    ChartBase.CHART_ADX,
                    ChartBase.CHART_CCI,
                    ChartBase.CHART_CFM,
                    ChartBase.CHART_CHAIKIN,
                    ChartBase.CHART_MASSINDEX,
                    ChartBase.CHART_MFI,
                    ChartBase.CHART_MACD,
                    ChartBase.CHART_MCDX,
                    ChartBase.CHART_NVI,
                    ChartBase.CHART_PVI,
                    ChartBase.CHART_OBV,
                    ChartBase.CHART_ROC,
                    ChartBase.CHART_PVT,
                    ChartBase.CHART_RSI,
                    ChartBase.CHART_CRS_RATIO,
                    ChartBase.CHART_COMPARING_SECOND_SHARE,
                    //ChartBase.CHART_CRS_PERCENT,
                    ChartBase.CHART_STOCHASTIC_FAST,
                    ChartBase.CHART_STOCHASTIC_SLOW,
                    ChartBase.CHART_STOCHRSI,
                    ChartBase.CHART_TRIX,
                    ChartBase.CHART_WILLIAMR,
                    ChartBase.CHART_VOLUME,
                    //ChartBase.CHART_THUYPS,
                    -1,
                    C.ID_REMOVE_SUB_CHART
                };
                string[] ss =
                {
                    "Aroon",
                    "Aroon Oscillator",
                    "ATR - Average true range",
                    "ADL - Accumulation Distribution Line",
                    "ADX - Average Directional Index",
                    "CCI - Commodity Channel Index",
                    "CMF - Chaikin Money Flow",
                    "Chaikin Oscillator",
                    "Mass Index (Mass)",
                    "MFI - Money Flow Index",
                    "MACD - Moving Average Convergence-Divergence",
                    "MCDX",
                    "NVI - Negative Volume Index",
                    "PVI - Positive Volume Index",
                    "OBV - On Balance Volume",
                    "ROC - Rate of Change",
                    "PVT - Price Volume Trend",
                    "RSI - Relative Strength Index",
                    "Relative Strength Comparative (RS=A/B)",
                    //"Relative Price performance (RS=[A/A(period)]/[B/B(period)])",
                    "So sánh VNINDEX",
                    "Stochastic Fast",
                    "Stochastic Full",
                    "StochRSI",
                    "TRIX - Triple Exponential Average",
                    "William %R",
                    "Volume",
                    //"ThuyPS",
                    "",
                    "Đóng đồ thị (Thêm: Ctrl + chọn đồ thị)",
                };

                int cnt = ids.Length;
                if (!add_removable)
                {
                    cnt -= 2;
                }
                setMenuContext(ids, ss, cnt);
            }
        }
        public void setChart(ChartBase c)
        {
            //removeControl(mSwitchButton);
            c.mShouldDrawGrid = mHasGrid;

            removeAllControls();
            //====================================

            if (mCurrentChart != null)
            {
                removeControl(mCurrentChart);
            }

            //  chart
            //addControl(c);
            mCurrentChart = c;
            mCurrentChart.setListener(this);

            Context ctx = Context.getInstance();

            ImageList imgs = ctx.getImageList(C.IMG_SUB_BUTTONS, 16, 15);
            int       x    = 0;
            int       y    = 0;

            //  setting
            if (mSettingButton == null)
            {
                mSettingButton = xButton.createImageButton(C.ID_BUTTON_SETTING_CHART, this, imgs, 0);

                mSettingButton.setPosition(0, (getH() - mSettingButton.getH()) - 1);

                x = mSettingButton.getRight();
            }
            addControl(mSettingButton);
            y = (getH() - mSettingButton.getH()) - 1;
            //  grid
            if (mDrawGridButton == null)
            {
                mDrawGridButton = xButton.createImageButton(C.ID_BUTTON_DRAW_GRID, this, imgs, 4);
                mDrawGridButton.setPosition(x, y);
                x = mDrawGridButton.getRight();
            }
            addControl(mDrawGridButton);
            //  sma
            if (c.isSupportSecondChart())
            {
                if (mSecondChartButton == null)
                {
                    mSecondChartButton = xButton.createImageButton(C.ID_BUTTON_SECOND_CHART, this, imgs, 1);

                    mSecondChartButton.setPosition(x, y);
                    x = mSecondChartButton.getRight();
                }
                addControl(mSecondChartButton);
            }
            //  help
            bool hasHelp   = false;
            int  chartType = c.getChartType();

            if (chartType == ChartBase.CHART_ADL ||
                chartType == ChartBase.CHART_ADX ||
                chartType == ChartBase.CHART_CCI ||
                chartType == ChartBase.CHART_CHAIKIN ||
                chartType == ChartBase.CHART_ICHIMOKU ||
                chartType == ChartBase.CHART_MACD ||
                chartType == ChartBase.CHART_MFI ||
                chartType == ChartBase.CHART_OBV ||
                chartType == ChartBase.CHART_ROC ||
                chartType == ChartBase.CHART_NVI ||
                chartType == ChartBase.CHART_PVI ||
                chartType == ChartBase.CHART_PVT ||
                chartType == ChartBase.CHART_CCI ||
                chartType == ChartBase.CHART_MASSINDEX ||
                chartType == ChartBase.CHART_RSI ||
                chartType == ChartBase.CHART_STOCHASTIC_FAST ||
                chartType == ChartBase.CHART_STOCHASTIC_SLOW ||
                chartType == ChartBase.CHART_STOCHRSI ||
                chartType == ChartBase.CHART_TRIX ||
                chartType == ChartBase.CHART_WILLIAMR ||
                chartType == ChartBase.CHART_VOLUMEBYPRICE)
            {
                hasHelp = true;
            }

            if (mHelpButton == null)
            {
                mHelpButton = xButton.createImageButton(C.ID_BUTTON_CONTEXT_HELP, this, imgs, 3);
                mHelpButton.setPosition(0, y - mHelpButton.getH());
            }
            if (hasHelp)
            {
                addControl(mHelpButton);
            }

            /*
             * if (mRemoveButton == null)
             * {
             * //mAddButton = xButton.createStandardButton(Constants.ID_ADD_SUB_CHART, this, " + ", 30);
             * //mAddButton.setPosition(mSwitchButton.getRight(), mSwitchButton.getY());
             * mRemoveButton = xButton.createStandardButton(C.ID_REMOVE_SUB_CHART, this, " - ", 30);
             * mRemoveButton.setPosition(0, getH() - mRemoveButton.getH()-1);
             * //mRemoveButton.setPosition(mSwitchButton.getRight(), mSwitchButton.getY());
             * }*/

            //addControl(mAddButton);
            //addControl(mRemoveButton);

            addControl(c);

            //  context menu here

            /*
             * //  help
             * img = ctx->getImage("help0.png");
             * img1 = ctx->getImage("help1.png");
             * xUIButton *bt = xUIButton::createImageButton(ID_BUTTON_CONTEXT_HELP, this, 0, img, img1);
             * bt->setPosition(0, mSwitchButton->getY() - mSwitchButton ->getH());
             * addControl(bt);
             */
        }
Beispiel #9
0
 public void setChart(ChartBase chart)
 {
     mChart = chart;
 }
Beispiel #10
0
 public void setRefChartForSize(ChartBase refChart)
 {
     mRefChartForSize = refChart;
 }
Beispiel #11
0
 public void setRefChart(ChartBase refChart)
 {
     mRefChart = refChart;
 }