Пример #1
0
        private static BulletGraph CreateBulletGraph()
        {
            var chart = new BulletGraph
            {
                Caption    = "Revenue",
                SubCaption = "US $ (1,000s)"
            };

            chart.Axis.LowerLimit = 0;
            chart.Axis.UpperLimit = 100;
            // chart.AxisAttr.LowerLimitDisplay = "Bad";
            // chart.AxisAttr.UpperLimitDisplay = "Good";

            chart.Palette   = 4;
            chart.ShowValue = true;
            chart.NumberAttr.NumberPrefix = "$";
            chart.NumberAttr.NumberSuffix = "K";

            chart.PlotFillColor   = "#CC0000".FromHtml();
            chart.PlotFillAlpha   = 90;
            chart.TargetColor     = chart.PlotFillColor;
            chart.TargetThickness = 4;

            chart.DataStreamUrl   = "BulletRealTime.ashx";
            chart.RefreshInterval = 3;

            chart.Value  = 78.9;
            chart.Target = 80;

            BuildColorRange(chart);
            return(chart);
        }
Пример #2
0
 void InitializeBulletGraph(BulletGraph bulletGraph)
 {
     bulletGraph.BackColor                               = Color.White;
     bulletGraph.MinimumSize                             = new Size(600, 150);
     bulletGraph.QuantitativeScaleLength                 = 400;
     bulletGraph.QualitativeRangesSize                   = 32;
     bulletGraph.MinorTicksPerInterval                   = 1;
     bulletGraph.MajorTickSize                           = 14;
     bulletGraph.MinorTickSize                           = 8;
     bulletGraph.MajorTickStrokeThickness                = 2;
     bulletGraph.MinorTickStrokeThickness                = 2;
     bulletGraph.LabelFontSize                           = 10;
     bulletGraph.CaptionFontSize                         = 12;
     bulletGraph.FeaturedMeasureBarStrokeThickness       = 7;
     bulletGraph.ComparativeMeasureSymbolStrokeThickness = 5;
 }
Пример #3
0
 void InitializeBulletGraph(BulletGraph bulletGraph)
 {
     bulletGraph.BackColor                               = Color.White;
     bulletGraph.MinimumSize                             = GetPreferredSize(new Size(600, 150));
     bulletGraph.QuantitativeScaleLength                 = (int)DpiAware.LogicalToDeviceUnits(400);
     bulletGraph.QualitativeRangesSize                   = (int)DpiAware.LogicalToDeviceUnits(32);
     bulletGraph.MinorTicksPerInterval                   = (int)DpiAware.LogicalToDeviceUnits(1);
     bulletGraph.MajorTickSize                           = (int)DpiAware.LogicalToDeviceUnits(14);
     bulletGraph.MinorTickSize                           = (int)DpiAware.LogicalToDeviceUnits(8);
     bulletGraph.MajorTickStrokeThickness                = (int)DpiAware.LogicalToDeviceUnits(2);
     bulletGraph.MinorTickStrokeThickness                = (int)DpiAware.LogicalToDeviceUnits(2);
     bulletGraph.LabelFontSize                           = 10;
     bulletGraph.CaptionFontSize                         = 12;
     bulletGraph.FeaturedMeasureBarStrokeThickness       = (int)DpiAware.LogicalToDeviceUnits(7);
     bulletGraph.ComparativeMeasureSymbolStrokeThickness = (int)DpiAware.LogicalToDeviceUnits(5);
 }
Пример #4
0
 void InitializeBulletGraph(BulletGraph bulletGraph)
 {
     bulletGraph.BackColor                               = Color.White;
     bulletGraph.Dock                                    = DockStyle.Fill;
     bulletGraph.Orientation                             = Orientation.Vertical;
     bulletGraph.MinimumSize                             = new Size(400, 400);
     bulletGraph.QualitativeRangesSize                   = (int)DpiAware.LogicalToDeviceUnits(32);
     bulletGraph.MinorTicksPerInterval                   = (int)DpiAware.LogicalToDeviceUnits(1);
     bulletGraph.MajorTickSize                           = (int)DpiAware.LogicalToDeviceUnits(14);
     bulletGraph.MinorTickSize                           = (int)DpiAware.LogicalToDeviceUnits(8);
     bulletGraph.MajorTickStrokeThickness                = (int)DpiAware.LogicalToDeviceUnits(2);
     bulletGraph.MinorTickStrokeThickness                = (int)DpiAware.LogicalToDeviceUnits(2);
     bulletGraph.LabelFontSize                           = 10;
     bulletGraph.CaptionFontSize                         = 12;
     bulletGraph.FeaturedMeasureBarStrokeThickness       = (int)DpiAware.LogicalToDeviceUnits(7);
     bulletGraph.ComparativeMeasureSymbolStrokeThickness = (int)DpiAware.LogicalToDeviceUnits(5);
 }
Пример #5
0
 void InitializeBulletGraph(BulletGraph bulletGraph)
 {
     bulletGraph.BackColor                               = Color.White;
     bulletGraph.Dock                                    = DockStyle.Fill;
     bulletGraph.Orientation                             = Orientation.Vertical;
     bulletGraph.MinimumSize                             = new Size(400, 400);
     bulletGraph.QualitativeRangesSize                   = 32;
     bulletGraph.MinorTicksPerInterval                   = 1;
     bulletGraph.MajorTickSize                           = 14;
     bulletGraph.MinorTickSize                           = 8;
     bulletGraph.MajorTickStrokeThickness                = 2;
     bulletGraph.MinorTickStrokeThickness                = 2;
     bulletGraph.LabelFontSize                           = 10;
     bulletGraph.CaptionFontSize                         = 12;
     bulletGraph.FeaturedMeasureBarStrokeThickness       = 7;
     bulletGraph.ComparativeMeasureSymbolStrokeThickness = 5;
 }
Пример #6
0
        public Form()
        {
            InitializeComponent();
            this.SizeChanged += Form_SizeChanged;
            var headerLabel = new Label();

            headerLabel.Dock      = DockStyle.Top;
            headerLabel.Height    = 80;
            headerLabel.Text      = "2005 YTD Actual Vs Budget";
            headerLabel.TextAlign = ContentAlignment.MiddleCenter;
            headerLabel.Font      = new Font("Segoe UI", 18F);

            bulletGraph1 = new BulletGraph();
            InitializeBulletGraph(bulletGraph1);
            bulletGraph1.Location           = new Point(20, 80);
            bulletGraph1.Minimum            = 0;
            bulletGraph1.Maximum            = 300;
            bulletGraph1.Interval           = 50;
            bulletGraph1.FeaturedMeasure    = 270;
            bulletGraph1.ComparativeMeasure = 250;
            bulletGraph1.Caption            = "     Revenue \n U.S. $ (1,000s)";
            bulletGraph1.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Bad", RangeEnd = 150, RangeStroke = Color.FromArgb(235, 235, 235)
            });
            bulletGraph1.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Good", RangeEnd = 225, RangeStroke = Color.FromArgb(216, 216, 216)
            });
            bulletGraph1.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Excellent", RangeEnd = 300, RangeStroke = Color.FromArgb(127, 127, 127)
            });

            bulletGraph2 = new BulletGraph();
            InitializeBulletGraph(bulletGraph2);
            bulletGraph2.Location           = new Point(20, 230);
            bulletGraph2.Minimum            = 0;
            bulletGraph2.Maximum            = 150;
            bulletGraph2.Interval           = 25;
            bulletGraph2.FeaturedMeasure    = 45;
            bulletGraph2.ComparativeMeasure = 30;
            bulletGraph2.Caption            = "     Expenses \n U.S. $ (1,000s)";
            bulletGraph2.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Bad", RangeEnd = 40, RangeStroke = Color.FromArgb(235, 235, 235)
            });
            bulletGraph2.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Good", RangeEnd = 80, RangeStroke = Color.FromArgb(216, 216, 216)
            });
            bulletGraph2.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Excellent", RangeEnd = 150, RangeStroke = Color.FromArgb(127, 127, 127)
            });

            bulletGraph3 = new BulletGraph();
            InitializeBulletGraph(bulletGraph3);
            bulletGraph3.Location           = new Point(20, 380);
            bulletGraph3.Minimum            = 0;
            bulletGraph3.Maximum            = 30;
            bulletGraph3.Interval           = 5;
            bulletGraph3.FeaturedMeasure    = 22.5;
            bulletGraph3.ComparativeMeasure = 27;
            bulletGraph3.Caption            = "     Profit \n Percentage(%)";
            bulletGraph3.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Bad", RangeEnd = 20, RangeStroke = Color.FromArgb(235, 235, 235)
            });
            bulletGraph3.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Good", RangeEnd = 25, RangeStroke = Color.FromArgb(216, 216, 216)
            });
            bulletGraph3.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Excellent", RangeEnd = 30, RangeStroke = Color.FromArgb(127, 127, 127)
            });

            var bulletGraphPanel = new Panel();

            bulletGraphPanel.Dock = DockStyle.Fill;
            bulletGraphPanel.Controls.Add(headerLabel);
            bulletGraphPanel.Controls.Add(bulletGraph1);
            bulletGraphPanel.Controls.Add(bulletGraph2);
            bulletGraphPanel.Controls.Add(bulletGraph3);

            var splitter = new Splitter();

            splitter.Dock      = DockStyle.Left;
            splitter.BackColor = Color.FromArgb(205, 205, 205);

            var flowDirectionLabel = new Label();

            flowDirectionLabel.Width     = 250;
            flowDirectionLabel.Margin    = new Padding(20, 30, 0, 0);
            flowDirectionLabel.Text      = "Flow Direction";
            flowDirectionLabel.TextAlign = ContentAlignment.MiddleLeft;
            flowDirectionLabel.Font      = new Font("Segoe UI", 12F);

            var flowDirectionComboBox = new ComboBox();

            flowDirectionComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            flowDirectionComboBox.Width                 = 250;
            flowDirectionComboBox.Margin                = new Padding(25, 20, 0, 0);
            flowDirectionComboBox.DataSource            = Enum.GetValues(typeof(BulletGraphFlowDirection));
            flowDirectionComboBox.SelectedValueChanged += flowDirectionComboBox_SelectedValueChanged;
            flowDirectionComboBox.Font = new Font("Segoe UI", 12F);

            var labelPositionLabel = new Label();

            labelPositionLabel.Width     = 250;
            labelPositionLabel.Margin    = new Padding(20, 30, 0, 0);
            labelPositionLabel.Text      = "Label Position";
            labelPositionLabel.TextAlign = ContentAlignment.MiddleLeft;
            labelPositionLabel.Font      = new Font("Segoe UI", 12F);

            labelPositionComboBox = new ComboBox();
            labelPositionComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            labelPositionComboBox.Width                 = 250;
            labelPositionComboBox.Margin                = new Padding(25, 20, 0, 0);
            labelPositionComboBox.DataSource            = Enum.GetValues(typeof(BulletGraphLabelsPosition));
            labelPositionComboBox.SelectedValueChanged += labelPositionComboBox_SelectedValueChanged;
            labelPositionComboBox.Font = new Font("Segoe UI", 12F);

            var tickPositionLabel = new Label();

            tickPositionLabel.Width     = 250;
            tickPositionLabel.Margin    = new Padding(20, 30, 0, 0);
            tickPositionLabel.Text      = "Tick Position";
            tickPositionLabel.TextAlign = ContentAlignment.MiddleLeft;
            tickPositionLabel.Font      = new Font("Segoe UI", 12F);

            tickPositionComboBox = new ComboBox();
            tickPositionComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            tickPositionComboBox.Width                 = 250;
            tickPositionComboBox.Margin                = new Padding(25, 20, 0, 0);
            tickPositionComboBox.DataSource            = Enum.GetValues(typeof(BulletGraphTicksPosition));
            tickPositionComboBox.SelectedValueChanged += tickPositionComboBox_SelectedValueChanged;
            tickPositionComboBox.Font = new Font("Segoe UI", 12F);

            var captionPositionLabel = new Label();

            captionPositionLabel.Width     = 250;
            captionPositionLabel.Margin    = new Padding(20, 30, 0, 0);
            captionPositionLabel.Text      = "Caption Position";
            captionPositionLabel.TextAlign = ContentAlignment.MiddleLeft;
            captionPositionLabel.Font      = new Font("Segoe UI", 12F);

            var captionPositionComboBox = new ComboBox();

            captionPositionComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            captionPositionComboBox.Width                 = 250;
            captionPositionComboBox.Margin                = new Padding(25, 20, 0, 0);
            captionPositionComboBox.DataSource            = Enum.GetValues(typeof(BulletGraphCaptionPosition));
            captionPositionComboBox.SelectedValueChanged += captionPositionComboBox_SelectedValueChanged;
            captionPositionComboBox.Font = new Font("Segoe UI", 12F);

            var optionsFlowLayoutPanel = new FlowLayoutPanel();

            optionsFlowLayoutPanel.Width         = 300;
            optionsFlowLayoutPanel.Dock          = DockStyle.Fill;
            optionsFlowLayoutPanel.FlowDirection = FlowDirection.TopDown;
            optionsFlowLayoutPanel.Controls.Add(flowDirectionLabel);
            optionsFlowLayoutPanel.Controls.Add(flowDirectionComboBox);
            optionsFlowLayoutPanel.Controls.Add(labelPositionLabel);
            optionsFlowLayoutPanel.Controls.Add(labelPositionComboBox);
            optionsFlowLayoutPanel.Controls.Add(tickPositionLabel);
            optionsFlowLayoutPanel.Controls.Add(tickPositionComboBox);
            optionsFlowLayoutPanel.Controls.Add(captionPositionLabel);
            optionsFlowLayoutPanel.Controls.Add(captionPositionComboBox);

            var optionsPanel = new Panel();

            optionsPanel.Dock  = DockStyle.Right;
            optionsPanel.Width = 300;
            optionsPanel.Controls.Add(splitter);
            optionsPanel.Controls.Add(optionsFlowLayoutPanel);

            Controls.Add(bulletGraphPanel);
            Controls.Add(optionsPanel);
        }
Пример #7
0
        public Form1()
        {
            InitializeComponent();

            bulletGraph1 = new BulletGraph();
            InitializeBulletGraph(bulletGraph1);
            bulletGraph1.Minimum            = 0;
            bulletGraph1.Maximum            = 1600;
            bulletGraph1.Interval           = 200;
            bulletGraph1.FeaturedMeasure    = 1400;
            bulletGraph1.ComparativeMeasure = 1072;
            bulletGraph1.Caption            = "CIT Revenue YTD \n      $ (millions) \n \n";
            bulletGraph1.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Bad", RangeEnd = 700, RangeStroke = Color.FromArgb(97, 163, 1)
            });
            bulletGraph1.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Good", RangeEnd = 1250, RangeStroke = Color.FromArgb(252, 218, 33)
            });
            bulletGraph1.QualitativeRanges.Add(new QualitativeRange {
                RangeCaption = "Excellent", RangeEnd = 1600, RangeStroke = Color.FromArgb(214, 30, 64)
            });

            var bulletGraphPanel = new Panel();

            bulletGraphPanel.Dock = DockStyle.Fill;
            bulletGraphPanel.Controls.Add(bulletGraph1);

            var splitter = new Splitter();

            splitter.Dock      = DockStyle.Left;
            splitter.BackColor = Color.FromArgb(205, 205, 205);

            var range1StrokeLabel = new Label();

            range1StrokeLabel.Width     = (int)DpiAware.LogicalToDeviceUnits(250);
            range1StrokeLabel.Height    = (int)DpiAware.LogicalToDeviceUnits(range1StrokeLabel.Height);
            range1StrokeLabel.Margin    = new Padding(20, 30, 0, 0);
            range1StrokeLabel.Text      = "Range1 Stroke";
            range1StrokeLabel.TextAlign = ContentAlignment.MiddleLeft;
            range1StrokeLabel.Font      = new Font("Segoe UI", 12F);

            range1StrokeComboBox = new ComboBox();
            range1StrokeComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            range1StrokeComboBox.Width                 = (int)DpiAware.LogicalToDeviceUnits(250);
            range1StrokeComboBox.Margin                = new Padding(25, 20, 0, 0);
            range1StrokeComboBox.SelectedValueChanged += range1StrokeComboBox_SelectedValueChanged;
            range1StrokeComboBox.Font = new Font("Segoe UI", 12F);

            var range2StrokeLabel = new Label();

            range2StrokeLabel.Width     = (int)DpiAware.LogicalToDeviceUnits(250);
            range2StrokeLabel.Height    = (int)DpiAware.LogicalToDeviceUnits(range2StrokeLabel.Height);
            range2StrokeLabel.Margin    = new Padding(20, 30, 0, 0);
            range2StrokeLabel.Text      = "Range2 Stroke";
            range2StrokeLabel.TextAlign = ContentAlignment.MiddleLeft;
            range2StrokeLabel.Font      = new Font("Segoe UI", 12F);

            range2StrokeComboBox = new ComboBox();
            range2StrokeComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            range2StrokeComboBox.Width                 = (int)DpiAware.LogicalToDeviceUnits(250);
            range2StrokeComboBox.Margin                = new Padding(25, 20, 0, 0);
            range2StrokeComboBox.SelectedValueChanged += range2StrokeComboBox_SelectedValueChanged;
            range2StrokeComboBox.Font = new Font("Segoe UI", 12F);

            var range3StrokeLabel = new Label();

            range3StrokeLabel.Width     = (int)DpiAware.LogicalToDeviceUnits(250);
            range3StrokeLabel.Height    = (int)DpiAware.LogicalToDeviceUnits(range3StrokeLabel.Height);
            range3StrokeLabel.Margin    = new Padding(20, 30, 0, 0);
            range3StrokeLabel.Text      = "Range3 Stroke";
            range3StrokeLabel.TextAlign = ContentAlignment.MiddleLeft;
            range3StrokeLabel.Font      = new Font("Segoe UI", 12F);

            range3StrokeComboBox = new ComboBox();
            range3StrokeComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            range3StrokeComboBox.Width                 = (int)DpiAware.LogicalToDeviceUnits(250);
            range3StrokeComboBox.Margin                = new Padding(25, 20, 0, 0);
            range3StrokeComboBox.SelectedValueChanged += range3StrokeComboBox_SelectedValueChanged;
            range3StrokeComboBox.Font = new Font("Segoe UI", 12F);

            var optionsFlowLayoutPanel = new FlowLayoutPanel();

            optionsFlowLayoutPanel.Width         = (int)DpiAware.LogicalToDeviceUnits(300);
            optionsFlowLayoutPanel.Dock          = DockStyle.Fill;
            optionsFlowLayoutPanel.FlowDirection = FlowDirection.TopDown;
            optionsFlowLayoutPanel.Controls.Add(range1StrokeLabel);
            optionsFlowLayoutPanel.Controls.Add(range1StrokeComboBox);
            optionsFlowLayoutPanel.Controls.Add(range2StrokeLabel);
            optionsFlowLayoutPanel.Controls.Add(range2StrokeComboBox);
            optionsFlowLayoutPanel.Controls.Add(range3StrokeLabel);
            optionsFlowLayoutPanel.Controls.Add(range3StrokeComboBox);

            var optionsPanel = new Panel();

            optionsPanel.Dock  = DockStyle.Right;
            optionsPanel.Width = (int)DpiAware.LogicalToDeviceUnits(300);
            optionsPanel.Controls.Add(splitter);
            optionsPanel.Controls.Add(optionsFlowLayoutPanel);

            Controls.Add(bulletGraphPanel);
            Controls.Add(optionsPanel);
        }