示例#1
0
        public RegionSales()
        {
            InitializeComponent();

            Random rnd = new Random();

            string[] states = new string[] { "Alabama", "Alaska", "Arizona", "Idaho", "Illinois", "Indiana", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Vermont", "Virginia", "Washington" };
            this.Sales = new ObservableCollection <RegionSalesData>();
            for (int i = 0; i < states.Length; i++)
            {
                RegionSalesData rsd = new RegionSalesData();
                rsd.State = states[i];
                rsd.Data  = new ObservableCollection <double>();
                for (int j = 0; j < 12; j++)
                {
                    double d = rnd.Next(-50, 50);
                    rsd.Data.Add(d);
                    rsd.NetSales   += d;
                    rsd.TotalSales += Math.Abs(d);
                }
                this.Sales.Add(rsd);
            }

            this.DataContext = this;
        }
示例#2
0
        public FlexGridIntegration()
        {
            Random rnd   = new Random();
            string state = Strings.StatesColumnValue;

            string[] states = state.Split('|');
            this.Sales = new ObservableCollection <RegionSalesData>();
            for (int i = 0; i < states.Length; i++)
            {
                RegionSalesData rsd = new RegionSalesData();
                rsd.State = states[i];
                rsd.Data  = new ObservableCollection <double>();
                for (int j = 0; j < 12; j++)
                {
                    double d = rnd.Next(-50, 50);
                    rsd.Data.Add(d);
                    rsd.NetSales   += d;
                    rsd.TotalSales += Math.Abs(d);
                }
                this.Sales.Add(rsd);
            }

            this.DataContext = this;

            this.InitializeComponent();
        }
示例#3
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            c1Sparkline1.Data = _sampleData.DefaultData;
            c1Sparkline2.Data = _sampleData.DefaultData;

            var sparklineTypes = _sampleData.SparklineTypes;

            var defaultColors = _sampleData.DefaultColors;

            // "See it in action" tab:
            cbxSparklineType.Items.AddRange(sparklineTypes);
            cbxSparklineType.SelectedIndex = 0;

            c1Sparkline1.DisplayXAxis = chbxDisplayXAxisAction.Checked;

            // "Appearance" tab:
            cbxAppearanceSparkLineType.Items.AddRange(sparklineTypes);
            cbxAppearanceSparkLineType.SelectedIndex = 0;

            cbxMarksColor.Items.AddRange(defaultColors);
            cbxMarksColor.SelectedIndex = 2;

            cbxHighMarksColor.Items.AddRange(defaultColors);
            cbxHighMarksColor.SelectedIndex = 1;

            cbxSeriesColor.Items.AddRange(defaultColors);
            cbxSeriesColor.SelectedIndex = 1;

            cbxFirstMarkColor.Items.AddRange(defaultColors);
            cbxFirstMarkColor.SelectedIndex = 7;

            cbxLowMarkColor.Items.AddRange(defaultColors);
            cbxLowMarkColor.SelectedIndex = 2;

            cbxAxisColor.Items.AddRange(defaultColors);
            cbxAxisColor.SelectedIndex = 3;

            cbxLastMarkColor.Items.AddRange(defaultColors);
            cbxLastMarkColor.SelectedIndex = 1;

            cbxNegativeColor.Items.AddRange(defaultColors);
            cbxNegativeColor.SelectedIndex = 1;

            c1Sparkline2.ShowMarkers  = chbxShowMarks.Checked;
            c1Sparkline2.DisplayXAxis = chbxDisplayXAxisAppearance.Checked;
            c1Sparkline2.ShowFirst    = chbxShowFirst.Checked;
            c1Sparkline2.ShowLast     = chbxShowLast.Checked;
            c1Sparkline2.ShowHigh     = chbxShowHigh.Checked;
            c1Sparkline2.ShowLow      = chbxShowLow.Checked;
            c1Sparkline2.ShowNegative = chbxShowNegative.Checked;

            c1Sparkline2.SparklineType           = (cbxAppearanceSparkLineType.SelectedItem as SparklineTypeItem).Type;
            c1Sparkline2.Styles.SeriesColor      = (cbxSeriesColor.SelectedItem as ColorItem).Value;
            c1Sparkline2.Styles.AxisColor        = (cbxAxisColor.SelectedItem as ColorItem).Value;
            c1Sparkline2.Styles.MarkersColor     = (cbxMarksColor.SelectedItem as ColorItem).Value;
            c1Sparkline2.Styles.FirstMarkerColor = (cbxFirstMarkColor.SelectedItem as ColorItem).Value;
            c1Sparkline2.Styles.LastMarkerColor  = (cbxLastMarkColor.SelectedItem as ColorItem).Value;
            c1Sparkline2.Styles.HighMarkerColor  = (cbxHighMarksColor.SelectedItem as ColorItem).Value;
            c1Sparkline2.Styles.LowMarkerColor   = (cbxLowMarkColor.SelectedItem as ColorItem).Value;
            c1Sparkline2.Styles.NegativeColor    = (cbxNegativeColor.SelectedItem as ColorItem).Value;

            // "Region sales" tab:

            Random rnd = new Random();

            string[] states = new string[] { "Alabama", "Alaska", "Arizona", "Idaho", "Illinois", "Indiana", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Vermont", "Virginia", "Washington" };

            var salesList = new List <RegionSalesData>();

            for (int i = 0; i < states.Length; i++)
            {
                var rsd = new RegionSalesData();
                rsd.State = states[i];

                rsd.SalesTrend  = new ObservableCollection <double>();
                rsd.WinLoss     = new ObservableCollection <double>();
                rsd.ProfitTrend = new ObservableCollection <double>();

                for (int j = 0; j < 12; j++)
                {
                    double d = rnd.Next(-50, 50);
                    rsd.SalesTrend.Add(d);
                    rsd.WinLoss.Add(d);
                    rsd.ProfitTrend.Add(d);
                    rsd.NetSales   += d;
                    rsd.TotalSales += Math.Abs(d);
                }

                salesList.Add(rsd);
            }

            fxgRegionSales.AllowEditing  = false;
            fxgRegionSales.AllowSorting  = C1.Win.C1FlexGrid.AllowSortingEnum.None;
            fxgRegionSales.AllowMerging  = C1.Win.C1FlexGrid.AllowMergingEnum.None;
            fxgRegionSales.SelectionMode = C1.Win.C1FlexGrid.SelectionModeEnum.Row;

            fxgRegionSales.DataSource = salesList;

            fxgRegionSales.Cols.DefaultSize = 170;
            fxgRegionSales.Rows.DefaultSize = 50;

            fxgRegionSales.Cols["TotalSales"].Format = "c2";

            var salesTrendColumn = fxgRegionSales.Cols["SalesTrend"];

            salesTrendColumn.ShowSparkline         = true;
            salesTrendColumn.Sparkline.ShowMarkers = true;

            var winLossColumn = fxgRegionSales.Cols["WinLoss"];

            winLossColumn.ShowSparkline           = true;
            winLossColumn.Sparkline.SparklineType = C1.Win.C1FlexGrid.SparklineType.WinLoss;
            winLossColumn.Sparkline.ShowNegative  = true;

            var profitTrendColumn = fxgRegionSales.Cols["ProfitTrend"];

            profitTrendColumn.ShowSparkline           = true;
            profitTrendColumn.Sparkline.SparklineType = C1.Win.C1FlexGrid.SparklineType.Column;
            profitTrendColumn.Sparkline.ShowHigh      = true;
            profitTrendColumn.Sparkline.ShowLow       = true;

            fxgRegionSales.Cols.MoveRange(1, 3, 4);
            fxgRegionSales.Cols.Remove(0);
        }