public HistSeriesChartView()
        {
            InitializeComponent();
            menuStrip = new ContextMenuStrip();
            CreateContextMenuItem();
            lineChartDataDisplay1.EnableZoom();

            CompositeLegend chartLegend = new CompositeLegend();
            lineChartDataDisplay1.Chart.CompositeChart.Legends.Add(chartLegend);
            //lineChartDataDisplay1.SetYAxisFormat("##0.000");
        }  
    public CompositeLegend AddCompositeLegendForAllLayers(bool clearCurrent_=true)
    {
      if(clearCurrent_)
        ultraChart.CompositeChart.Legends.Clear();

      CompositeLegend cl = new CompositeLegend();

      foreach (Infragistics.UltraChart.Resources.Appearance.ChartLayerAppearance layer in ultraChart.CompositeChart.ChartLayers)
      {
        cl.ChartLayers.Add(layer);
      }

      ultraChart.CompositeChart.Legends.Add(cl);


      return cl;
    }
    public void AddLegend()
    {
      ultraChart.CompositeChart.Legends.Clear();

      CompositeLegend legend = new CompositeLegend();

      foreach (Infragistics.UltraChart.Resources.Appearance.ChartLayerAppearance layer in ultraChart.CompositeChart.ChartLayers)
      {
          if (layer.ChartType == ChartType.LineChart || layer.ChartType == ChartType.ScatterChart)
            legend.ChartLayers.Add(layer);
      }

      ultraChart.CompositeChart.Legends.Add(legend);

      legend.Border.Color = Color.White;
      legend.LabelStyle.Font = new Font(legend.LabelStyle.Font.FontFamily, 10);
      legend.BoundsMeasureType = Infragistics.UltraChart.Shared.Styles.MeasureType.Percentage;
      legend.Bounds = new Rectangle(80, 0, 20, 100);
      legend.PE = new Infragistics.UltraChart.Resources.Appearance.PaintElement(Color.White, Color.LightGray, 125, 20, Infragistics.UltraChart.Shared.Styles.GradientStyle.ForwardDiagonal, Infragistics.UltraChart.Shared.Styles.PaintElementType.Gradient);
    }
Beispiel #4
0
        private void AlimentaGraficos()
        {
            //http://help.infragistics.com/Help/Doc/WinForms/2012.1/CLR2.0/html/Chart_Creating_a_Composite_Chart_in_Code_Part_1_of_2.html
            //http://help.infragistics.com/Help/Doc/WinForms/2012.1/CLR2.0/html/Chart_Creating_a_Composite_Chart_in_Code_Part_2_of_2.html

            //Aqui define o tipo de gráfico que será realizado.
            //https://www.infragistics.com/help/winforms/chart-2d-charts
            this.ultraChart1.ChartType = ChartType.Composite;

            ChartArea myChartArea = new ChartArea();

            this.ultraChart1.CompositeChart.ChartAreas.Add(myChartArea);

            AxisItem axisX = new AxisItem();

            axisX.OrientationType         = AxisNumber.X_Axis;
            axisX.DataType                = AxisDataType.String;
            axisX.SetLabelAxisType        = Infragistics.UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries;
            axisX.Labels.ItemFormatString = "<ITEM_LABEL>";
            axisX.Labels.Orientation      = TextOrientation.VerticalLeftFacing;

            AxisItem axisY = new AxisItem();

            axisY.OrientationType         = AxisNumber.Y_Axis;
            axisY.DataType                = AxisDataType.Numeric;
            axisY.Labels.ItemFormatString = "<DATA_VALUE:0.#>";

            //Adiciona os gráficos
            myChartArea.Axes.Add(axisX);
            myChartArea.Axes.Add(axisY);

            //Adiciona as séries na interface
            NumericSeries seriesA = GetNumericSeriesBound();
            NumericSeries seriesB = GetNumericSeriesUnBound();

            this.ultraChart1.CompositeChart.Series.Add(seriesA);
            this.ultraChart1.CompositeChart.Series.Add(seriesB);

            //Cria a aparência das colunas
            ChartLayerAppearance myColumnLayer = new ChartLayerAppearance();

            myColumnLayer.ChartType = ChartType.ColumnChart;
            myColumnLayer.ChartArea = myChartArea;
            myColumnLayer.AxisX     = axisX;
            myColumnLayer.AxisY     = axisY;
            myColumnLayer.Series.Add(seriesA);
            myColumnLayer.Series.Add(seriesB);
            this.ultraChart1.CompositeChart.ChartLayers.Add(myColumnLayer);

            //Cria a legenda
            CompositeLegend myLegend = new CompositeLegend();

            myLegend.ChartLayers.Add(myColumnLayer);
            myLegend.Bounds               = new Rectangle(0, 75, 20, 25);
            myLegend.BoundsMeasureType    = MeasureType.Percentage;
            myLegend.PE.ElementType       = PaintElementType.Gradient;
            myLegend.PE.FillGradientStyle = GradientStyle.ForwardDiagonal;
            myLegend.PE.Fill              = Color.CornflowerBlue;
            myLegend.PE.FillStopColor     = Color.Transparent;
            myLegend.Border.CornerRadius  = 10;
            myLegend.Border.Thickness     = 0;
            this.ultraChart1.CompositeChart.Legends.Add(myLegend);
        }
Beispiel #5
0
        private void ultraChart1_Load(object sender, EventArgs e)
        {
            this.ultraChart1.Tooltips.HighlightDataPoint = false;

            ultraChart1.ChartType = ChartType.Composite;
            ultraChart1.Data.ZeroAligned = true;

            ChartArea myChartArea = new ChartArea();
            this.ultraChart1.CompositeChart.ChartAreas.Add(myChartArea);

            AxisItem axisX = new AxisItem();
            AxisItem axisY = new AxisItem();

            //Line
            axisX.OrientationType = AxisNumber.X_Axis;
            axisX.DataType = AxisDataType.String;
            axisX.SetLabelAxisType = SetLabelAxisType.ContinuousData;
            axisX.Labels.ItemFormatString = "<ITEM_LABEL:M/d>";
            //axisX.Labels.ItemFormatString = "< MY_VALUE >";
            
            axisX.Labels.Orientation = TextOrientation.VerticalLeftFacing;
            axisX.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.None;
            axisX.LineThickness = 1;
            //axisX.Extent = 40;
            axisX.Labels.Visible = true;
            axisX.Labels.Font = ultraChart1.Axis.X.Labels.SeriesLabels.Font;
            axisX.Labels.FontColor = ultraChart1.Axis.X.Labels.SeriesLabels.FontColor;
            //axisX.ScrollScale.Visible = true;

            axisY.OrientationType = AxisNumber.Y_Axis;
            axisY.Labels.HorizontalAlign = StringAlignment.Far;
            axisY.DataType = AxisDataType.Numeric;
            axisY.Labels.ItemFormatString = "<DATA_VALUE:##.#>";
            //axisY.Labels.ItemFormatString = "< MY_VALUE >";
            
            axisY.TickmarkStyle = AxisTickStyle.Smart;
            axisY.LineThickness = 1;
            //axisY.Extent = 10;
            axisY.RangeType = AxisRangeType.Custom;
            axisY.RangeMin = 0;
            axisY.RangeMax = 600;
            axisY.Labels.Font = ultraChart1.Axis.Y.Labels.Font;
            axisY.Labels.FontColor = ultraChart1.Axis.Y.Labels.FontColor;

            myChartArea.Axes.Add(axisX);
            myChartArea.Axes.Add(axisY);
            
            ChartLayerAppearance myLineLayer1 = new ChartLayerAppearance();
            myLineLayer1.ChartType = ChartType.LineChart;
            myLineLayer1.ChartArea = myChartArea;
            myLineLayer1.AxisX = axisX;
            myLineLayer1.AxisY = axisY;

            ((LineChartAppearance)myLineLayer1.ChartTypeAppearance).Thickness = 1;


            DataTable table = new DataTable();
            table = GetLineData();
            for (int iC = 0; iC < table.Columns.Count - 1; iC++)
            {
                NumericSeries series = new NumericSeries();
                series.Data.DataSource = table;
                series.Data.LabelColumn = table.Columns[0].Caption.ToString();
                series.Data.ValueColumn = table.Columns[iC + 1].Caption.ToString();
                series.Label = table.Columns[iC + 1].Caption.ToString();
                series.DataBind();

                myLineLayer1.Series.Add(series);
            }

            ultraChart1.CompositeChart.ChartLayers.Add(myLineLayer1);

            ultraChart1.Tooltips.Format = TooltipStyle.DataValue;
            //ultraChart1.Tooltips.FormatString = "<DATA_VALUE:0> <ITEM_LABEL> <SERIES_LABEL>";
            ultraChart1.Tooltips.FormatString = "<DATA_VALUE>";


            CompositeLegend myLegend = new CompositeLegend();
            myLegend.ChartLayers.Add(myLineLayer1);
            myLegend.Bounds = new Rectangle(0, 1, 10, 50);
            myLegend.BoundsMeasureType = MeasureType.Percentage;
            myLegend.PE.ElementType = PaintElementType.None;
            myLegend.PE.FillGradientStyle = GradientStyle.ForwardDiagonal;
            myLegend.PE.FillStopColor = Color.Transparent;
            myLegend.Border.CornerRadius = 0;
            myLegend.Border.Thickness = 2;
            
            ultraChart1.CompositeChart.Legends.Add(myLegend);

            Hashtable MyLabelHashTable = new Hashtable();
            MyLabelHashTable.Add("MY_VALUE", new MyLabelRenderer());
            this.ultraChart1.LabelHash = MyLabelHashTable;
            this.ultraChart1.Tooltips.Format = TooltipStyle.Custom;
            this.ultraChart1.Tooltips.FormatString = "<MY_VALUE>";
            this.ultraChart1.Tooltips.Overflow = TooltipOverflow.ChartArea;
        }