Exemplo n.º 1
0
Arquivo: Line.cs Projeto: nistck/Jx
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="start">Start point.</param>
        /// <param name="end">End point.</param>
        public Line(PointF start, PointF end)
        {
            if (start.X == end.X)
            {
                end = new PointF(end.X + 1, end.Y);
            }

            if (start.Y == end.Y)
            {
                end = new PointF(end.X, end.Y + 1);
            }

            Geometric.AddLine(start, end);
            Appearance = new LineAppearance();
        }
Exemplo n.º 2
0
    private void reloadBondSpreadsOverCMT_BottomLeftChart()
    {
      lblSpreadOverCMT.Text = string.Format("Spread of {0} bonds over {1} CMT", m_source.Primary, m_source.Secondary);

      lcdSpreadOverCMT_BottomLeft.ClearSeries();

      //var hist = m_source.SpreadsOverCMT.Select(x => x.GetHistory(m_source.HistWinLength)).ToList();

      //var con = new ConstructGenGen<string, double>(new[] {"high", "low", "avg"});
      //for(int i=0;i<hist.Count;++i)
      //{
      //  if (hist[i] == null) // not enough history
      //    con.SetValues(m_source.SpreadsOverCMT[i].Bond, new[] {0d, 0d, 0d});
      //  else
      //    con.SetValues(m_source.SpreadsOverCMT[i].Bond,
      //      new[] {hist[i].Data.Max(), hist[i].Data.Min(), hist[i].Data.Average()});
      //}

      //lcdSpreadOverCMT.AddBoxSeries(
      //  desc_: "range",

      //  data_: con,
      //  highIndex_: 0,
      //  lowIndex_: 1,
      //  averageIndex_: 2,
      //  q1Index_: 2,
      //  q3Index_: 3,
      //  yLabelformat_: null,
      //  color_: Color.White,
      //  xAxisExtent_: 80);

      var chart = lcdSpreadOverCMT_BottomLeft.AddSeries<BondSpreadOverCMT>(
        source_: m_source.SpreadsOverCMT,
        dateField_: "Maturity",
        valueField_: "LiveSpread",
        desc_: "Live Spread over CMT",
        color_: Color.Red,
        yAxisExtent_: 40,
        yLabelFormat_: "##0.0",
        labelField_: "Bond",
        lineThickness: 1);

      chart.AxisX.TickmarkStyle = Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Smart;
      lcdSpreadOverCMT_BottomLeft.Chart.Data.ZeroAligned = true;

      lcdSpreadOverCMT_BottomLeft.Chart.Data.ZeroAligned = true;
      var lcapp = (LineChartAppearance) chart.ChartTypeAppearance;
      lcapp.MidPointAnchors = true;

      var la = new LineAppearance();
      la.IconAppearance.Icon = Infragistics.UltraChart.Shared.Styles.SymbolIcon.Diamond;
      la.IconAppearance.IconSize = Infragistics.UltraChart.Shared.Styles.SymbolIconSize.Medium;
      la.Thickness = 1;

      lcapp.LineAppearances.Add(la);
    }
Exemplo n.º 3
0
    private void reload2CMTSpread_TopLeftChart()
    {
      lcdCurveSpread_TopLeft.ClearSeries();

      if (m_source.Primary == BondMarket.None || m_source.Secondary == BondMarket.None ||
          m_source.Primary == m_source.Secondary)
        return;

      lblCurveSpread.Text = string.Format("{0} {1} CMT Spread", m_source.Primary, m_source.Secondary);

      // first for the history...

      var histSpread =
        CMTHelper.GetHistoricalSpreads(m_source.Primary, m_source.Secondary, m_source.Focus)
          .TakeEndValues(m_source.HistWinLength);

      // if we've got enough hsitory
      if (histSpread.Keys.Count == m_source.HistWinLength)
      {
        var con = new ConstructGenGen<string, double>(new[] {"high", "low", "avg"});

        for (int i = 0; i < CMTLine.DisplayPoints.Length; ++i)
        {
          var point = (int) CMTLine.DisplayPoints[i];
          var spreadOfPoint = histSpread.GetColumnValues(point - 1);

          con.SetValues(point.ToString(), new[] {spreadOfPoint.Max()*10000d, spreadOfPoint.Min()*10000d, spreadOfPoint.Average()*10000d});
        }

        lcdCurveSpread_TopLeft.AddBoxSeries("range", con, 0, 1, 2, 2, 2, null, Color.White);
      }

      var chart = lcdCurveSpread_TopLeft.AddSeries<CMTLineDiff>(
        source_: getSpreadObject(),
        xAxisValues_: CMTLine.DisplayPoints.Select(x => string.Format("{0}", x)).ToArray(),
        valueFields_: CMTLine.DisplayPoints.Select(x => string.Format("Y{0}", x)).ToArray(),
        desc_: "cmtspread",
        yAxisExtent_:40,
        color_: Color.Red,
        yLabelFormat_: "###0.0",
        lineThickness_: 0);

      lcdCurveSpread_TopLeft.Chart.Data.ZeroAligned = true;
      var lcapp = (LineChartAppearance)chart.ChartTypeAppearance;
      lcapp.MidPointAnchors = true;

      var la = new LineAppearance();
      la.IconAppearance.Icon = Infragistics.UltraChart.Shared.Styles.SymbolIcon.Diamond;
      la.IconAppearance.IconSize = Infragistics.UltraChart.Shared.Styles.SymbolIconSize.Medium;
      la.Thickness = 0;

      lcapp.LineAppearances.Add(la);


    }
Exemplo n.º 4
0
        //public static UltraChart GetChart2(UltraChart chart, object datasource, int width, int height)
        //{

        //    if ((chart == null))
        //    {
        //        chart = new UltraChart();
        //    }
        //    chart.FillSceneGraph += TemperaturChartFillSceneGraph;
        //    var ultraChart = chart;
        //    ultraChart.AccessKey = "A";
        //    //.ID = "ChartVergleichJahr"
        //    ultraChart.ChartType = ChartType.LineChart;
        //    ultraChart.ImagePipePageName = Constants.ImagePipePageName; ;
        //    ultraChart.DeploymentScenario = deploymentScenario;
        //    ultraChart.Width = width;
        //    ultraChart.Height = height;
        //    ultraChart.Border.Thickness = 0;

        //    var colorModel = ultraChart.ColorModel;
        //    colorModel.ModelStyle = ColorModels.CustomLinear;
        //    //.AlphaLevel = 150
        //    colorModel.CustomPalette = Constants.ChartColors;

        //    var gradientEffect = new GradientEffect
        //    {
        //        Coloring = GradientColoringStyle.Darken
        //    };
        //    ultraChart.Effects.Add(gradientEffect);

        //    //LineAppearance Start
        //    var lineApp1 = new LineAppearance
        //    {
        //        Thickness = 2,
        //        LineStyle =
        //        {
        //            DrawStyle = LineDrawStyle.Dash,
        //            MidPointAnchors = false
        //        },

        //    };
        //    lineApp1.IconAppearance.Icon = SymbolIcon.None;


        //    var lineApp2 = new LineAppearance
        //    {
        //        LineStyle =
        //        {
        //            DrawStyle = LineDrawStyle.Solid,
        //            MidPointAnchors = true,
        //            EndStyle = LineCapStyle.DiamondAnchor
        //        },
        //        Thickness = 2
        //    };
        //    //LineAppearance END

        //    var lineChart = ultraChart.LineChart;
        //    lineChart.LineAppearances.Add(lineApp2);
        //    lineChart.LineAppearances.Add(lineApp2);
        //    lineChart.LineAppearances.Add(lineApp1);
        //    lineChart.NullHandling = NullHandling.InterpolateSimple;
        //    lineChart.TreatDateTimeAsString = false;
        //    lineChart.Thickness = 1;
        //    //*** Line width ****
        //    lineChart.MidPointAnchors = true;

        //    var legend = ultraChart.Legend;
        //    legend.Visible = true;
        //    legend.Location = LegendLocation.Top;
        //    legend.SpanPercentage = 6;
        //    legend.BorderThickness = 0;
        //    legend.AlphaLevel = 15;
        //    legend.DataAssociation = ChartTypeData.DefaultData;
        //    var marginsAppearance = legend.Margins;
        //    marginsAppearance.Bottom = 1;
        //    marginsAppearance.Top = 1;
        //    marginsAppearance.Left = 50;
        //    marginsAppearance.Right = 1;

        //    var axis = ultraChart.Axis;
        //    axis.PE.ElementType = PaintElementType.None;
        //    axis.PE.Fill = Color.Cornsilk;

        //    //'*** Implementierungs IRenderLabel für die Labels-Formatierung 

        //    {
        //        Hashtable labelHash = new Hashtable();
        //        labelHash.Add("MY_MONTH_LABEL", new TempMonthLabelRenderer());
        //        chart.LabelHash = labelHash;
        //        chart.Axis.X.Labels.ItemFormat = AxisItemLabelFormat.Custom;
        //        chart.Axis.X.Labels.ItemFormatString = "<MY_MONTH_LABEL>";
        //    }
        //    //'*** END Implementierungs IRenderLabel-Interface für die Labels-Formatierung

        //    var axisX = ultraChart.Axis.X;
        //    axisX.Extent = 10;
        //    axisX.LineColor = Color.LightGray;
        //    axisX.LineThickness = 1;
        //    axisX.TickmarkStyle = AxisTickStyle.DataInterval;
        //    axisX.TickmarkInterval = 1;
        //    axisX.TickmarkIntervalType = AxisIntervalType.Months;
        //    //axisX.Labels.ItemFormatString = "<ITEM_LABEL:MMM>";
        //    axisX.Labels.Orientation = TextOrientation.Horizontal;
        //    axisX.Labels.VerticalAlign = StringAlignment.Far;
        //    axisX.Labels.HorizontalAlign = StringAlignment.Far;
        //    axisX.Labels.Font = new Font("Verdana", 7, FontStyle.Regular, GraphicsUnit.Point);
        //    axisX.Labels.FontColor = Color.DimGray;

        //    //axisX.Labels.SeriesLabels.Font = new Font("Verdana", 7, FontStyle.Regular, GraphicsUnit.Point);
        //    //axisX.Labels.SeriesLabels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing;
        //    //axisX.Labels.SeriesLabels.FontColor = Color.DimGray;
        //    //axisX.Labels.SeriesLabels.HorizontalAlign = StringAlignment.Near;
        //    //axisX.Labels.SeriesLabels.VerticalAlign = StringAlignment.Center;
        //    axisX.MajorGridLines.Visible = false;
        //    axisX.MinorGridLines.Visible = false;



        //    var axisY = ultraChart.Axis.Y;
        //    axisY.Extent = 15;
        //    axisY.LineThickness = 1;
        //    axisY.TickmarkInterval = 10;
        //    axisY.TickmarkStyle = AxisTickStyle.Smart;

        //    axisY.Labels.Orientation = TextOrientation.Horizontal;
        //    axisY.Labels.HorizontalAlign = StringAlignment.Far;
        //    axisY.Labels.VerticalAlign = StringAlignment.Center;
        //    axisY.Labels.ItemFormatString = "<DATA_VALUE:00.##>";
        //    axisY.Labels.Font = new Font("Verdana", 7, FontStyle.Regular, GraphicsUnit.Point);
        //    axisY.Labels.FontColor = Color.DimGray;

        //    //.Labels.SeriesLabels.Font = New Font("Verdana", 7, FontStyle.Regular, GraphicsUnit.Point)
        //    //.Labels.SeriesLabels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing
        //    //.Labels.SeriesLabels.FontColor = Color.DimGray
        //    //.Labels.SeriesLabels.HorizontalAlign = StringAlignment.Far
        //    //.Labels.SeriesLabels.VerticalAlign = StringAlignment.Center
        //    axisY.MinorGridLines.Visible = false;
        //    //With .MajorGridLines
        //    //    .Visible = True
        //    //    .AlphaLevel = 255
        //    //    .Color = Color.LightGray
        //    //    .DrawStyle = LineDrawStyle.Solid
        //    //    .Thickness = 1
        //    //End With


        //    var titleLeft = ultraChart.TitleLeft;
        //    titleLeft.Visible = true;
        //    titleLeft.Text = "Mittlere Außentemperatur [°C]";
        //    titleLeft.Extent = 15;
        //    titleLeft.Font = new Font("Arial", 9.75f, FontStyle.Bold, GraphicsUnit.Point);
        //    titleLeft.HorizontalAlign = StringAlignment.Center;
        //    var titleLeftMarginswith10 = titleLeft.Margins;
        //    titleLeftMarginswith10.Bottom = 1;
        //    titleLeftMarginswith10.Top = 1;
        //    titleLeftMarginswith10.Left = 1;
        //    titleLeftMarginswith10.Right = 1;

        //    var titleTop = ultraChart.TitleTop;
        //    titleTop.Extent = 33;
        //    titleTop.ClipText = false;
        //    titleTop.Font = new Font("Arial", 8, FontStyle.Bold, GraphicsUnit.Point);
        //    var titleTopMargins = titleTop.Margins;
        //    titleTopMargins.Bottom = 10;
        //    titleTopMargins.Top = 0;
        //    titleTopMargins.Left = 15;
        //    titleTopMargins.Right = 0;

        //    var titleBottom = ultraChart.TitleBottom;
        //    titleBottom.Visible = false;


        //    //' ''*** Implementierungs IRenderLabel für die Labels-Formatierung 
        //    Hashtable labelHash2 = new Hashtable();
        //    labelHash2.Add("MY_TOOLTIP_LABEL", new TemperaturLabelRenderer());
        //    if (chart.LabelHash == null)
        //    {
        //        ultraChart.LabelHash = labelHash2;
        //    }
        //    else
        //    {
        //        ultraChart.LabelHash.Add("MY_TOOLTIP_LABEL", new TemperaturLabelRenderer());
        //    }

        //    var tooltips = ultraChart.Tooltips;
        //    tooltips.FormatString = "<MY_TOOLTIP_LABEL>";
        //    tooltips.Overflow = TooltipOverflow.ClientArea;
        //    tooltips.BorderThickness = 0;
        //    tooltips.EnableFadingEffect = true;

        //    ultraChart.Drill.Enabled = true;
        //    ultraChart.Drill.DrillElements = new DrillElement[] { new DrillElement() };
        //    ultraChart.Drill.DrillElements[0].DrillDown = new TemperaturDrillDown(chart);
        //    var data = ultraChart.Data;
        //    //.UseRowLabelsColumn = True
        //    //.ZeroAligned = True
        //    data.SwapRowsAndColumns = true;
        //    data.EmptyStyle.EnableLineStyle = true;
        //    data.EmptyStyle.EnablePoint = true;
        //    data.EmptyStyle.EnablePE = true;
        //    data.DataSource = datasource;
        //    data.DataBind();
            
        //    return chart;
        //}

        public static UltraChart GetChart(UltraChart chart, object datasource, int width, int height, params string[] columnLabels)
        {
            
            if ((chart == null))
            {
                chart = new UltraChart();
            }

            if (columnLabels != null)
            {
                chart.Data.SetColumnLabels(columnLabels);
            }

            chart.FillSceneGraph += TemperaturChartFillSceneGraph;
            var ultraChart = chart;
            ultraChart.AccessKey = "A";
            //.ID = "ChartVergleichJahr"
            ultraChart.ChartType = ChartType.LineChart;
            ultraChart.ImagePipePageName = Constants.ImagePipePageName;
            ultraChart.DeploymentScenario = deploymentScenario;
            ultraChart.Width = width;
            ultraChart.Height = height;
            ultraChart.Border.Thickness = 0;

            var colorModel = ultraChart.ColorModel;
            colorModel.ModelStyle = ColorModels.CustomLinear;
            //.AlphaLevel = 150
            colorModel.CustomPalette = Constants.ChartColors;

            var gradientEffect = new GradientEffect
            {
                Coloring = GradientColoringStyle.Darken
            };
            ultraChart.Effects.Add(gradientEffect);

            //LineAppearance Start
            var lineApp1 = new LineAppearance
            {
                Thickness = 2,
                LineStyle =
                {
                    DrawStyle = LineDrawStyle.Dash,
                    MidPointAnchors = false
                },
                
            };
            lineApp1.IconAppearance.Icon = SymbolIcon.None;
            lineApp1.IconAppearance.IconSize = SymbolIconSize.Small;

            var lineApp2 = new LineAppearance
            {
                LineStyle =
                {
                    DrawStyle = LineDrawStyle.Solid,
                    MidPointAnchors = true,
                    EndStyle = LineCapStyle.DiamondAnchor
                },
                Thickness = 2
            };
            lineApp2.IconAppearance.IconSize = SymbolIconSize.Small;
            //LineAppearance END

            var lineChart = ultraChart.LineChart;
            lineChart.LineAppearances.Add(lineApp2);
            lineChart.LineAppearances.Add(lineApp2);
            lineChart.LineAppearances.Add(lineApp1);
            lineChart.NullHandling = NullHandling.InterpolateSimple;
            lineChart.TreatDateTimeAsString = false;
            lineChart.Thickness = 1;
            //*** Line width ****
            lineChart.MidPointAnchors = true;

            var legend = ultraChart.Legend;
            legend.Visible = true;
            legend.Location = LegendLocation.Top;
            legend.SpanPercentage = 6;
            legend.BorderThickness = 0;
            legend.AlphaLevel = 15;
            legend.DataAssociation = ChartTypeData.DefaultData;
            var marginsAppearance = legend.Margins;
            marginsAppearance.Bottom = 1;
            marginsAppearance.Top = 1;
            marginsAppearance.Left = 50;
            marginsAppearance.Right = 1;

            var axis = ultraChart.Axis;
            axis.PE.ElementType = PaintElementType.None;
            axis.PE.Fill = Color.Cornsilk;

            //'*** Implementierungs IRenderLabel für die Labels-Formatierung 

            {
                Hashtable labelHash = new Hashtable();
                labelHash.Add("MY_MONTH_LABEL", new TempMonthLabelRenderer());
                chart.LabelHash = labelHash;
                chart.Axis.X.Labels.ItemFormat = AxisItemLabelFormat.Custom;
                chart.Axis.X.Labels.ItemFormatString = "<MY_MONTH_LABEL>";
            }
            //'*** END Implementierungs IRenderLabel-Interface für die Labels-Formatierung

            var axisX = ultraChart.Axis.X;
            axisX.Extent = 15;
            axisX.LineColor = Color.LightGray;
            axisX.LineThickness = 1;
            axisX.TickmarkStyle = AxisTickStyle.DataInterval;
            axisX.TickmarkInterval = 1;
            axisX.TickmarkIntervalType = AxisIntervalType.Months;
            //axisX.Labels.ItemFormatString = "<ITEM_LABEL:MMM>";
            axisX.Labels.Orientation = TextOrientation.Horizontal;
            axisX.Labels.VerticalAlign = StringAlignment.Far;
            axisX.Labels.HorizontalAlign = StringAlignment.Far;
            axisX.Labels.Font = new Font("Verdana", 9, FontStyle.Regular, GraphicsUnit.Point);
            axisX.Labels.FontColor = Color.Black;
            axisX.Labels.Layout.Padding = 15;

            //axisX.Labels.SeriesLabels.Font = new Font("Verdana", 7, FontStyle.Regular, GraphicsUnit.Point);
            //axisX.Labels.SeriesLabels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing;
            //axisX.Labels.SeriesLabels.FontColor = Color.DimGray;
            //axisX.Labels.SeriesLabels.HorizontalAlign = StringAlignment.Near;
            //axisX.Labels.SeriesLabels.VerticalAlign = StringAlignment.Center;
            axisX.MajorGridLines.Visible = false;
            axisX.MinorGridLines.Visible = false;

            var axisY = ultraChart.Axis.Y;
            axisY.Extent = 30;
            axisY.LineThickness = 1;
            axisY.TickmarkInterval = 10;
            axisY.TickmarkStyle = AxisTickStyle.Smart;

            axisY.Labels.Orientation = TextOrientation.Horizontal;
            axisY.Labels.HorizontalAlign = StringAlignment.Far;
            //axisY.Labels.VerticalAlign = StringAlignment.Center;
            axisY.Labels.ItemFormatString = "<DATA_VALUE:00.######>";
            axisY.Labels.Font = new Font("Verdana", 9, FontStyle.Regular, GraphicsUnit.Point);
            axisY.Labels.FontColor = Color.Black;

            //.Labels.SeriesLabels.Font = New Font("Verdana", 7, FontStyle.Regular, GraphicsUnit.Point)
            //.Labels.SeriesLabels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing
            //.Labels.SeriesLabels.FontColor = Color.DimGray
            //.Labels.SeriesLabels.HorizontalAlign = StringAlignment.Far
            //.Labels.SeriesLabels.VerticalAlign = StringAlignment.Center
            axisY.MinorGridLines.Visible = false;
            //With .MajorGridLines
            //    .Visible = True
            //    .AlphaLevel = 255
            //    .Color = Color.LightGray
            //    .DrawStyle = LineDrawStyle.Solid
            //    .Thickness = 1
            //End With


            var titleLeft = ultraChart.TitleLeft;
            titleLeft.Visible = true;
            titleLeft.Text = "Mittlere Außentemperatur [°C]";
            titleLeft.Extent = 15;
            titleLeft.Font = new Font("Arial", 9.75f, FontStyle.Bold, GraphicsUnit.Point);
            titleLeft.HorizontalAlign = StringAlignment.Center;
            var titleLeftMarginswith10 = titleLeft.Margins;
            titleLeftMarginswith10.Bottom = 1;
            titleLeftMarginswith10.Top = 1;
            titleLeftMarginswith10.Left = 1;
            titleLeftMarginswith10.Right = 1;

            var titleTop = ultraChart.TitleTop;
            titleTop.Extent = 33;
            titleTop.ClipText = false;
            titleTop.Font = new Font("Arial", 8, FontStyle.Bold, GraphicsUnit.Point);
            var titleTopMargins = titleTop.Margins;
            titleTopMargins.Bottom = 10;
            titleTopMargins.Top = 0;
            titleTopMargins.Left = 15;
            titleTopMargins.Right = 0;

            var titleBottom = ultraChart.TitleBottom;
            titleBottom.Visible = false;


            //' ''*** Implementierungs IRenderLabel für die Labels-Formatierung 
            Hashtable labelHash2= new Hashtable();
            labelHash2.Add("MY_TOOLTIP_LABEL", new TemperaturLabelRenderer());
            if (chart.LabelHash == null)
            {
                ultraChart.LabelHash = labelHash2;
            }
            else
            {
                ultraChart.LabelHash.Add("MY_TOOLTIP_LABEL", new TemperaturLabelRenderer());
            }

            var tooltips = ultraChart.Tooltips;
            tooltips.FormatString = "<MY_TOOLTIP_LABEL>";
            tooltips.Overflow = TooltipOverflow.ClientArea;
            tooltips.BorderThickness = 0;
            tooltips.EnableFadingEffect = true;

            ultraChart.Drill.Enabled = true;
            ultraChart.Drill.DrillElements = new DrillElement[] { new DrillElement() };
            ultraChart.Drill.DrillElements[0].DrillDown = new TemperaturDrillDown(chart);
            var data = ultraChart.Data;
            //.UseRowLabelsColumn = True
            //.ZeroAligned = True
            data.SwapRowsAndColumns = true;
            data.EmptyStyle.EnableLineStyle = true;
            data.EmptyStyle.EnablePoint = true;
            data.EmptyStyle.EnablePE = true;
            data.DataSource = datasource;
            data.DataBind();

            return chart;
        }
Exemplo n.º 5
0
Arquivo: Line.cs Projeto: nistck/Jx
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="line">Line to copy.</param>
 public Line(Line line) : base(line)
 {
     Appearance = new LineAppearance();
 }
Exemplo n.º 6
0
Arquivo: Line.cs Projeto: nistck/Jx
        /// <summary>
        /// Default constructor.
        /// </summary>
        public Line()
        {
            Geometric.AddLine(new PointF(0, 0), new PointF(1, 1));

            Appearance = new LineAppearance();
        }