Exemplo n.º 1
0
        public static void insertInListWithMax(List <Model.Data> list, Model.Data value, int max)
        {
            list.Insert(0, value);

            int listC = list.Count;

            if (listC > max)
            {
                for (int i = max; i < listC; i++)
                {
                    list.RemoveAt(list.Count - 1);
                }
            }
        }
Exemplo n.º 2
0
        public void onPrePaintChart(object sender, ChartPaintEventArgs e)
        {
            Double indexOfPointFarRight = Math.Min((BusinessConf.sizeOfEntryList - (SystemConf.percentageOfinitialListNotDisplayed / 100) * BusinessConf.sizeOfEntryList), Model.entryList.Count);

            //ARROW
            using (Pen pen = new Pen(Color.Blue, 1.5f))
            {
                Double x = e.Chart.ChartAreas[0].AxisX.ValueToPixelPosition(indexOfPointFarRight - 1);
                Double y = e.Chart.ChartAreas[0].AxisY.ValueToPixelPosition(Model.entryList[0]);
                e.ChartGraphics.Graphics.DrawLine(pen, (float)x + 10, (float)y - 10, (float)x, (float)y);
                e.ChartGraphics.Graphics.DrawLine(pen, (float)x + 3, (float)y, (float)x, (float)y);
                e.ChartGraphics.Graphics.DrawLine(pen, (float)x, (float)y - 3, (float)x, (float)y);
            }

            //MINS AND MAXS
            for (int count = Model.MinMaxList.Count, i = 0; i < count; i++)
            {
                Model.Data dataPoint = Model.MinMaxList[i];
                if (dataPoint.x > indexOfPointFarRight)
                {
                    break;
                }
                Double x = e.Chart.ChartAreas[0].AxisX.ValueToPixelPosition(indexOfPointFarRight - 1 - dataPoint.x);
                Double y = e.Chart.ChartAreas[0].AxisY.ValueToPixelPosition(dataPoint.datas[0]);
                if (dataPoint.descriptor == "MIN")
                {
                    using (Pen pen = new Pen(Color.Green, 1.5f))
                    {
                        e.ChartGraphics.Graphics.DrawLine(pen, (float)x + 1, (float)y + 1, (float)x, (float)y);
                        e.ChartGraphics.Graphics.DrawLine(pen, (float)x - 1, (float)y + 1, (float)x, (float)y);
                        e.ChartGraphics.Graphics.DrawLine(pen, (float)x, (float)y + 5, (float)x, (float)y);
                    }
                }
                else if (dataPoint.descriptor == "MAX")
                {
                    using (Pen pen = new Pen(Color.Red, 1.5f))
                    {
                        e.ChartGraphics.Graphics.DrawLine(pen, (float)x + 1, (float)y - 1, (float)x, (float)y);
                        e.ChartGraphics.Graphics.DrawLine(pen, (float)x - 1, (float)y - 1, (float)x, (float)y);
                        e.ChartGraphics.Graphics.DrawLine(pen, (float)x, (float)y - 5, (float)x, (float)y);
                    }
                }
            }
        }