コード例 #1
0
        private void CreateSeries(ChartProcess newValue, string yvalue, string categoryName)
        {
            ChartSeries stackingBarSeries = new ChartSeries();

            stackingBarSeries.Type = ChartSeriesType.StackingBar;
            var dataSource = new BindingList <ChartProcess>();

            dataSource.Add(newValue);
            stackingBarSeries.CategoryModel = new CategoryAxisDataBindModel(dataSource)
            {
                CategoryName = categoryName, YNames = new string[] { yvalue }
            };
            // stackingBarSeries.Style.Border.Color = Color.White;
            stackingBarSeries.Style.DisplayText     = true;
            stackingBarSeries.Style.TextOrientation = ChartTextOrientation.RegionCenter;
            stackingBarSeries.Style.Text            = newValue.SeriesLabel;
            stackingBarSeries.Style.TextColor       = Color.White;
            stackingBarSeries.Style.Border.Color    = Color.White;
            this.Width += 30;
            Series.Add(stackingBarSeries);
        }
コード例 #2
0
        private void CreateAxisLabels(ChartProcess newValue)
        {
            if (this.PrimaryXAxis.ValueType == ChartValueType.Double)
            {
                double xValue = newValue.XValue;
                int    count  = this.PrimaryXAxis.Labels.Count;
                if (count > 0)
                {
                    //Added current value with previous value.
                    xValue += (PrimaryXAxis.Labels[count - 1] as ChartAxisLabel).DoubleValue;
                }
                else
                {
                    //Added zero label for first position.
                    this.PrimaryXAxis.Labels.Add(new ChartAxisLabel("0", Color.White, this.Font));
                }

                //Custom label collection
                this.PrimaryXAxis.Labels.Add(new ChartAxisLabel(xValue, "##")
                {
                    Color = Color.White
                });
            }
        }