Example #1
0
        public ActionResult SaveGroup(ChartGroup customReport)
        {
            int    flag = 0;
            string ret  = Resources.SunResource.CUSTOM_SAVE_SUCCESSFULLY;
            User   user = UserUtil.getCurUser();

            if (null != user && UserUtil.demousername.Equals(user.username))
            {
                ret = "Sorry,exampleuser prohibit to save";
                return(Content(ret));
            }
            else if (string.IsNullOrEmpty(customReport.groupName))
            {
                ret = Resources.SunResource.CUSTOMREPORT_PLEASE_ENTER_GROUP;
                return(Content(ret));
            }
            try
            {
                if (ChartGroupService.GetInstance().Get(customReport) != null)
                {
                    flag = ChartGroupService.GetInstance().Update(customReport);
                }
                else
                {
                    flag = ChartGroupService.GetInstance().Insert(customReport);
                }
            }
            catch (Exception ee)
            { }
            return(Content(ret));
        }
        /// <summary>
        /// The mouse move event handler.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void c1Chart1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button.Equals(MouseButtons.None))
            {
                int        s = -1, p = -1, d = -1;
                ChartGroup grp = c1Chart1.ChartGroups[0];
                if (grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XandYCoord, ref s, ref p, ref d))
                {
                    if (p >= 0 && d == 0)
                    {
                        if (prePointIndex == -1 && prePointIndex != p)
                        {
                            string   ftr;
                            DiskInfo info = arrDiskInfo[p];
                            if (p < diskCount)
                            {
                                ftr = string.Format("Total Capacity: {0} | VolumnName: {1} | File System: {2}", this.GetSizeString(info.Size, this.Format), info.VolumnName, info.FileSystem);
                            }
                            else
                            {
                                ftr = string.Format("Total Capacity: {0}", this.GetSizeString(info.Size, this.Format));
                            }

                            c1Chart1.Footer.Text = ftr;
                            prePointIndex        = p;
                        }
                    }
                    else
                    {
                        c1Chart1.Footer.Text = "Please move the mouse on each pie to see information in details.";
                        prePointIndex        = -1;
                    }
                }
            }
        }
        private void AddBarValueLabel(int x, int y)
        {
            if (x < 0 || y < 0)
            {
                oldSeries = -1;
                oldPoint  = -1;
                return;
            }

            int        s = -1, p = -1, d = -1;
            ChartGroup grp = c1Chart1.ChartGroups[0];

            if (grp.CoordToDataIndex(x, y, CoordinateFocusEnum.XCoord, ref s, ref p, ref d))
            {
                if (s >= 0 && p >= 0 && d == 0)
                {
                    if (s == oldSeries && p == oldPoint)
                    {
                        return;
                    }
                    txtCurSeriesValue.Text = ((grp.ChartData[s].Y[p])).ToString();
                    if (data.Frequency != null && s < data.Frequency.Length)
                    {
                        txtCurFrqValue.Text = data.Frequency[s].ToString();
                    }
                    return;
                }
            }

            AddBarValueLabel(-1, -1);
        }
Example #4
0
        private void ConfigureChart(bool threed, bool doughnut)
        {
            ChartGroup g = c1Chart1.ChartGroups.Group0;

            g.Use3D           = threed;
            g.Pie.InnerRadius = doughnut ? 30 : 0;
        }
Example #5
0
        //offsets a particular pie slice
        private void ExplodeSlice(C1.Win.C1Chart.C1Chart chart, int series, int offset, bool fromClick)
        {
            if (radImageLabels.Checked)
            {
                ChartGroup g = chart.ChartGroups.Group0;
                ChartDataSeriesCollection seriesList = g.ChartData.SeriesList;

                for (int i = 0; i < seriesList.Count; i++)
                {
                    if (i == series)
                    {
                        if (seriesList[i].Offset == 10 && fromClick)
                        {
                            seriesList[i].Offset = 0;
                            RemoveSliceImage(chart, i);
                        }
                        else
                        {
                            seriesList[i].Offset = offset;
                            AnnotateSlicewithImage(chart, i);
                        }
                        return;
                    }
                }
            }
        }
Example #6
0
 private void radHiLo_CheckedChanged(object sender, EventArgs e)
 {
     ResetChart();
     if (radChartGroups.Checked)
     {
         ChartGroup g = c1Chart1.ChartGroups.Group0;
         g.ChartType = C1.Win.C1Chart.Chart2DTypeEnum.Candle;
         g.ChartData.SeriesList[0].LineStyle.Thickness = 2;
         c1Chart1.ChartGroups.Group1.Visible           = true;
         c1Chart1.ChartArea.AxisY2.Visible             = true;
     }
     else if (radHiLoOpenClose.Checked)
     {
         c1Chart1.ChartGroups.Group0.ChartType = C1.Win.C1Chart.Chart2DTypeEnum.HiLoOpenClose;
     }
     else if (radCandle.Checked)
     {
         ChartGroup g = c1Chart1.ChartGroups.Group0;
         g.ChartType = C1.Win.C1Chart.Chart2DTypeEnum.Candle;
         g.ChartData.SeriesList[0].LineStyle.Thickness = 2;
     }
     else
     {
         c1Chart1.ChartGroups.Group0.ChartType = C1.Win.C1Chart.Chart2DTypeEnum.HiLo;
     }
 }
Example #7
0
        void Chart1_MouseMove(object sender, MouseEventArgs e)
        {
            ChartGroup grp = Chart1.ChartGroups.Group0;

            ps = grp.ChartData.PointStylesList[0];
            // if both are changed to valid values, then something needs to be highlighted
            int seriesIndex = -1, pointIndex = -1;


            // check if the mouse is in the PlotArea.
            if (Chart1.ChartRegionFromCoord(e.X, e.Y) == ChartRegionEnum.PlotArea)
            {
                int dist = 0;

                // find the closest XCoord.
                if (grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XCoord, ref seriesIndex, ref pointIndex, ref dist))
                {
                    // if there are multiple series in the chart, then find the closest series.
                    if (grp.CoordToSeriesIndex(e.X, e.Y, PlotElementEnum.Series, ref seriesIndex, ref dist))
                    {
                        ps.PointIndex  = pointIndex;
                        ps.SeriesIndex = seriesIndex;
                        label3.Text    = tlist[pointIndex].ToString();
                        label4.Text    = ylist[pointIndex].ToString();
                    }
                }

                if (seriesIndex == -1 || pointIndex == -1)
                {
                    ps.PointIndex  = -1;
                    ps.SeriesIndex = -1;
                }
            }
        }
Example #8
0
 private void OnGroupChecked(object sender, RoutedEventArgs e)
 {
     chartGroup = new ChartGroup()
     {
         HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch
     };
 }
        private void c1Chart1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button.Equals(MouseButtons.None))
            {
                C1Chart         chart  = (C1Chart)sender;
                ChartRegionEnum region = chart.ChartRegionFromCoord(e.X, e.Y);

                int g = -1, s = -1, p = -1, d = -1;
                if (region.Equals(ChartRegionEnum.Legend))
                {
                    if (chart.Legend.SeriesFromCoord(e.X, e.Y, ref g, ref s))
                    {
                        if (g >= 0 && s >= 0)
                        {
                            chart.Footer.Text = "Series #" + s.ToString();
                        }
                    }
                }
                else
                {
                    ChartGroup grp = chart.ChartGroups[0];
                    if (grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XandYCoord, ref s, ref p, ref d))
                    {
                        if (d == 0 && s >= 0 && p >= 0)
                        {
                            chart.Footer.Text = "Slice #" + s.ToString();
                        }
                        else if (!chart.Footer.Text.Equals("Nowhere"))
                        {
                            chart.Footer.Text = "Nowhere";
                        }
                    }
                }
            }
        }
Example #10
0
        public string GetGroupAjax(ChartGroup rg)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("    $('" + "#aGroupDel" + rg.id + "').click(function() {");
            sb.Append("            if (confirm(\"删除改组将会同时删除改组下的自定义报表; 确定删除'" + rg.groupName + "'?\") == \"0\") {");
            sb.Append("              return;");
            sb.Append("             } else {");
            sb.Append("             $.ajax({");
            sb.Append("              type: \"POST\",");
            sb.Append("              url: \"/CustomReport/DeleteGroup\",");
            //sb.Append("              data: { id: $('" + "#hGroup" + rg.id + "').val() },");
            sb.Append("              data: { id: \"" + rg.id + "\" },");
            sb.Append("            success: function(result) {");
            sb.Append("                 $('" + "#divGroup" + "').empty();");
            sb.Append("                 $('" + "#divGroup" + "').append(result);");
            sb.Append("              }");
            sb.Append("          });");
            sb.Append("       }");
            sb.Append("       });");
            //sb.Append("       $('" + "#aGroupEdit" + rg.id + "').click(function() {");
            //sb.Append("            $.ajax({");
            //sb.Append("                 type: \"GET\",");
            //sb.Append("                url: \"/CustomReport/CreateGroup\",");
            ////sb.Append("                data: { id: $('" + "#hGroup" + rg.id + "').val() },");
            //sb.Append("                data: { id: \"" + rg.id + "\" },");
            //sb.Append("               success: function(result) {");
            //// sb.Append("                   $('#divGroup').empty();");
            ////sb.Append("                    $('#divGroup').append(result);");
            //sb.Append("                }");
            //sb.Append("            });");
            //sb.Append("        });");
            return(sb.ToString());
        }
Example #11
0
        public string GetGroupTr(ChartGroup rg)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("     <tr>");
            sb.Append("      <td width=\"100%\">");
            sb.Append("        <table width=\"100%\" border=\"0\" cellspacing=\"0\" class=\"cxtal\">");
            sb.Append("           <tr>");
            sb.Append("            <td width=\"54%\" height=\"40\" align=\"left\" class=\"pl40\">");
            sb.Append("              <strong>" + rg.groupName + "</strong>");
            sb.Append("              <input id=\"hGroup" + rg.id + "\" type=\"hidden\" value=\"" + rg.id + "\" />");
            sb.Append("             </td>");
            sb.Append("             <td width=\"23%\" align=\"center\">");
            sb.Append("              <a href=\"/CustomReport/CreateGroup/" + rg.id + "\" id=\"aGroupEdit" + rg.id + "\">");
            sb.Append("               <img src=\"/images/sub/hammer_screwdriver.gif\" width=\"16\" height=\"16\" class=\"imga\" /></a>");
            sb.Append("             </td>");
            sb.Append("             <td width=\"23%\" align=\"center\">");
            sb.Append("              <a href=\"#\" id=\"aGroupDel" + rg.id + "\">");
            sb.Append("                <img src=\"/images/sub/cross.png\" width=\"16\" height=\"16\" class=\"imga\" /></a>");
            sb.Append("              </td>");
            sb.Append("               </tr>");
            sb.Append("            </table>");
            sb.Append("         </td>");
            sb.Append("      </tr>");
            return(sb.ToString());
        }
Example #12
0
        /// <summary>
        /// 确定Chart的宽度值,以磅为单位
        /// </summary>
        /// <param name="DrawingChart">进行绘图的Chart</param>
        /// <param name="PointsCount">选择的基坑区域的数量</param>
        /// <param name="LeastWidth_Chart">Chart对象的宽度的最小值,即使图表中只有很少的点</param>
        /// <param name="LeastWidth_Column">柱形图中每一个柱形的最小宽度,用来进行基本的文本书写</param>
        /// <returns></returns>
        /// <remarks></remarks>
        private double GetChartWidth(Microsoft.Office.Interop.Excel.Chart DrawingChart, UInt16 PointsCount, double
                                     LeastWidth_Chart, double LeastWidth_Column, double Margin, ref
                                     double InsideWidth)
        {
            double ChartWidth = LeastWidth_Chart;

            InsideWidth = LeastWidth_Chart - Margin;
            //
            Microsoft.Office.Interop.Excel.Chart            with_1 = DrawingChart;
            Microsoft.Office.Interop.Excel.SeriesCollection src    = with_1.SeriesCollection();
            UInt16     n        = src.Count;
            double     hh       = LeastWidth_Chart / PointsCount;
            ChartGroup ChtGroup = with_1.ChartGroups(1);
            // ------------------------------------------------------------------------------------------------
            //1、在已知最小的chart宽度(即最小的PlotArea.InsideWidth)的情况下,验算柱形的宽度是否比指定的最小柱形宽度要大
            double H = InsideWidth;

            // Dim O As Single = ChtGroup.Overlap / 100
            ChtGroup.Overlap = 0;
            float  G           = (float)((double)ChtGroup.GapWidth / 100);
            double ColumnWidth = hh / (1 + G + n);

            if (ColumnWidth < LeastWidth_Column)
            {
                // ------------------------------------------------------------------------------------------------
                //2、在已知柱体的最小宽度的情况下,去推算整个PlotArea.InsideWidth的值
            }
            return(ChartWidth);
        }
Example #13
0
        private void ConfigureSymbols(bool lines)
        {
            ChartGroup g = c1Chart1.ChartGroups.Group0;
            ChartDataSeriesCollection series = g.ChartData.SeriesList;
            int n = 0;

            SymbolShapeEnum[] shapes =
            {
                SymbolShapeEnum.Box,
                SymbolShapeEnum.Dot,
                SymbolShapeEnum.Diamond,
                SymbolShapeEnum.Tri
            };

            foreach (ChartDataSeries s in series)
            {
                s.SymbolStyle.Shape = shapes[n++];

                if (lines)
                {
                    s.LineStyle.Thickness = 1;
                }
                else
                {
                    s.LineStyle.Pattern = LinePatternEnum.None;
                }
            }
        }
        private void ValueLabelChangedHandler(object sender, EventArgs e)
        {
            ValueLabelsCollection vls = c1Chart1.ChartArea.AxisX.ValueLabels;
            string minMarker = "M1", maxMarker = "M2";

            if (vls["M1"].NumericValue > vls["M2"].NumericValue)
            {
                minMarker = "M2";  maxMarker = "M1";
            }

            float minValue = (float)vls[minMarker].NumericValue;
            float maxValue = (float)vls[maxMarker].NumericValue;

            string    name = (string)zoneSelect.Items[3];
            AlarmZone az   = c1Chart1.ChartArea.PlotArea.AlarmZones[name];

            int             gi  = az.GroupIndex;
            int             si  = az.PolygonData.SeriesIndex;
            ChartGroup      cg  = c1Chart1.ChartGroups[gi];
            ChartDataSeries cds = cg.ChartData.SeriesList[si];

            PointF[] pfs = (PointF[])cds.PointData.CopyDataOut();
            int      pmin = -1, pmax = -1;
            float    minY = float.MaxValue, maxY = float.MinValue;

            for (int p = 0; p < pfs.Length; p++)
            {
                if (pmin < 0 && pfs[p].X >= minValue)
                {
                    pmin = p;
                }

                if (pmax < 0 && pfs[p].X >= maxValue)
                {
                    pmax = (pfs[p].X == maxValue) ? p :  p - 1;
                    break;
                }

                if (pmin >= 0)
                {
                    if (pfs[p].Y < minY)
                    {
                        minY = pfs[p].Y;
                    }
                    if (pfs[p].Y > maxY)
                    {
                        maxY = pfs[p].Y;
                    }
                }
            }

            az.NearExtent  = pfs[pmin].X;
            az.FarExtent   = pfs[pmax].X;
            az.UpperExtent = maxY;
            az.LowerExtent = minY;
        }
Example #15
0
        private void ConfigureStepChart(bool threed)
        {
            ResetChart();
            ChartGroup g = c1Chart1.ChartGroups.Group0;

            g.ChartType = Chart2DTypeEnum.Step;
            ChartDataSeriesCollection series = g.ChartData.SeriesList;

            g.Use3D = threed;
        }
Example #16
0
        private void ConfigureAreaChart(bool threed, bool stacked, bool hundred)
        {
            ResetChart();
            ChartGroup g = c1Chart1.ChartGroups.Group0;

            g.ChartType    = Chart2DTypeEnum.Area;
            g.Use3D        = threed;
            g.Stacked      = stacked;
            g.Is100Percent = hundred;
        }
Example #17
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (ExampleCategory != null ? ExampleCategory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ChartGroup != null ? ChartGroup.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ExampleTitle != null ? ExampleTitle.GetHashCode() : 0);
         return(hashCode);
     }
 }
        private void c1Chart1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            C1Chart    chart = (C1Chart)sender;
            int        g = 0, s = -1, p = -1, d = -1;
            ChartGroup grp = chart.ChartGroups[g];

            ChartRegionEnum region = chart.ChartRegionFromCoord(e.X, e.Y);

            string footerText = "Nowhere";

            if (region.Equals(ChartRegionEnum.Legend))
            {
                // if in the legend, check for the series and update
                // the footerText as appropriate
                Legend leg = chart.Legend;
                if (leg.SeriesFromCoord(e.X, e.Y, ref g, ref s))
                {
                    if (s >= 0)
                    {
                        footerText = string.Format("Series {0}", s);
                    }
                }
            }
            else
            {
                // if it's close enough check for the series and update
                // the footerText as appropriate
                CoordinateFocusEnum focus = CoordinateFocusEnum.XandYCoord;
                bool stacked = grp.Stacked;
                int  minDist = 5;

                if (radioBar.Checked && !stacked)
                {
                    // special case where X focus is more appropriate
                    focus   = CoordinateFocusEnum.XCoord;
                    minDist = 0;
                }
                else if (radioPie.Checked || (radioBar.Checked && stacked))
                {
                    // special case where minimum distance of 0 is more
                    // appropriate.
                    minDist = 0;
                }

                if (grp.CoordToDataIndex(e.X, e.Y, focus, ref s, ref p, ref d))
                {
                    if (s >= 0 && p >= 0 && d <= minDist)
                    {
                        footerText = string.Format("Index({0},{1})", s, p);
                    }
                }
            }

            chart.Footer.Text = footerText;
        }
Example #19
0
        /// <summary>
        /// 删除分组
        /// </summary>
        /// <param name="customReport"></param>
        /// <returns></returns>
        public ActionResult DeleteGroup(string id, string returnUrl)
        {
            User       user = UserUtil.getCurUser();
            ChartGroup mode = new ChartGroup();

            mode.id = int.Parse(id);
            ChartGroupService.GetInstance().Remove(mode);
            CustomChartService.GetInstance().Delete(mode.id);

            //  string ret = GetHtml(user.id);
            return(new RedirectResult(returnUrl));
        }
Example #20
0
        private void ConfigureColumnChart(bool threed, bool stacked, bool hundred, bool multirow, BarAppearanceEnum shape)
        {
            ResetChart();
            ChartGroup g = c1Chart1.ChartGroups.Group0;

            g.ChartType      = Chart2DTypeEnum.Bar;
            g.Bar.Appearance = shape;
            g.Bar.MultiRow   = multirow;
            g.Use3D          = threed;
            g.Stacked        = stacked;
            g.Is100Percent   = hundred;
        }
Example #21
0
        private void ConfigureBarChart(bool threed, bool stacked, bool hundred, BarAppearanceEnum shape)
        {
            ResetChart();
            c1Chart1.ChartArea.Inverted = true;
            ChartGroup g = c1Chart1.ChartGroups.Group0;

            g.ChartType      = Chart2DTypeEnum.Bar;
            g.Bar.Appearance = shape;
            g.Use3D          = threed;
            g.Stacked        = stacked;
            g.Is100Percent   = hundred;
        }
        private void radioChartTypeChanged(object sender, System.EventArgs e)
        {
            RadioButton rb = (RadioButton)sender;

            if (rb.Checked)
            {
                Chart2DTypeEnum ct = (Chart2DTypeEnum)rb.Tag;
                c1Chart1.ChartGroups[0].ChartType = ct;

                int  maxSeries = 10;
                bool stackable = true;

                // special cases that limit the number of series shown.
                // this allows the demo to use the same data for all charts.
                switch (ct)
                {
                case Chart2DTypeEnum.Pie:
                    stackable = false;
                    break;

                case Chart2DTypeEnum.HiLo:
                case Chart2DTypeEnum.Bubble:
                    stackable = false;
                    maxSeries = 2;
                    break;

                case Chart2DTypeEnum.HiLoOpenClose:
                case Chart2DTypeEnum.Candle:
                    stackable = false;
                    maxSeries = 1;
                    break;
                }

                checkStacked.Enabled = stackable;

                ChartGroup grp = c1Chart1.ChartGroups[0];
                ChartDataSeriesCollection sl = grp.ChartData.SeriesList;
                int slim = sl.Count;
                for (int s = 0; s < slim; s++)
                {
                    if (s < maxSeries)
                    {
                        sl[s].Display = SeriesDisplayEnum.Show;
                    }
                    else
                    {
                        sl[s].Display = SeriesDisplayEnum.Exclude;
                    }
                }
            }
        }
        private void c1Chart1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            C1Chart chart = (C1Chart)sender;

            if (e.Button.Equals(MouseButtons.Left))
            {
                int             g = -1, s = -1, p = -1, d = -1;
                ChartGroup      grp = chart.ChartGroups[0];
                ChartDataSeries ser = null;

                ChartRegionEnum region = chart.ChartRegionFromCoord(e.X, e.Y);
                if (region.Equals(ChartRegionEnum.Legend))
                {
                    if (chart.Legend.SeriesFromCoord(e.X, e.Y, ref g, ref s))
                    {
                        ser = grp.ChartData.SeriesList[s];
                        if (ser.Display.Equals(SeriesDisplayEnum.Show))
                        {
                            ser.Display = SeriesDisplayEnum.Hide;
                        }
                        else
                        {
                            ser.Display = SeriesDisplayEnum.Show;
                        }
                    }
                    return;
                }

                if (grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XandYCoord,
                                         ref s, ref p, ref d))
                {
                    if (d == 0 && s >= 0 && p >= 0)
                    {
                        ser = grp.ChartData.SeriesList[s];
                        int offset = ser.Offset;
                        if (offset == 0)
                        {
                            offset = 40;
                        }
                        else
                        {
                            offset = 0;
                        }
                        ser.Offset = offset;

                        SetTextBoxSliceOffsetValue(s, offset);
                    }
                }
            }
        }
Example #24
0
        internal Image BuildChart(DataView data)
        {
            // select chart type
            ChartGroup cg = _chart.ChartGroups.Group0;
            Area       ca = _chart.ChartArea;

            switch (_chartType.Text)
            {
            case "Area":
                cg.ChartType = Chart2DTypeEnum.Area;
                ca.Inverted  = false;
                ca.AxisX.AnnotationRotation = 45;
                break;

            case "Bar":
                cg.ChartType = Chart2DTypeEnum.Bar;
                ca.Inverted  = true;
                ca.AxisX.AnnotationRotation = 0;
                break;

            default:
                cg.ChartType = Chart2DTypeEnum.XYPlot;
                ca.Inverted  = false;
                ca.AxisX.AnnotationRotation = 45;
                break;
            }

            // add data to the chart
            PointF[] points = new PointF[data.Count];
            for (int i = 0; i < data.Count; i++)
            {
                points[i].X = i;
                points[i].Y = float.Parse(data[i]["ProductSales"].ToString());
            }
            cg.ChartData.SeriesList[0].PointData.CopyDataIn(points);

            // add X labels to the chart
            Axis ax = _chart.ChartArea.AxisX;

            ax.ValueLabels.Clear();
            for (int i = 0; i < data.Count; i++)
            {
                ax.ValueLabels.Add(i, data[i]["ProductName"].ToString());
            }
            ax.AnnoMethod = AnnotationMethodEnum.ValueLabels;

            // get chart image
            return(_chart.GetImage(ImageFormat.Emf));
        }
Example #25
0
        private void cbUseYIntercept_CheckedChanged(object sender, EventArgs e)
        {
            ChartGroup cg = c1Chart1.ChartGroups[0];

            if (cg.ChartData.TrendsList.Count > 0)
            {
                TrendLine tl = cg.ChartData.TrendsList[0];
                tl.RegressionOptions.UseYIntercept = cbUseYIntercept.Checked;

                UpdateStatisticsLabel();
                UpdateFormulaLabel();
            }

            udYIntercept.Visible = cbUseYIntercept.Checked;
        }
Example #26
0
        private void LoadData()
        {
            //clear the existing data and add new Series data.
            ChartGroup cg = c1Chart1.ChartGroups.Group0;
            ChartDataSeriesCollection cdsc = cg.ChartData.SeriesList;

            cdsc.Clear();

            //create a new series for each "row" of the Gantt chart.
            //TASK ONE
            AddGanttSeriesData(cdsc, "Idea Generation",
                               new DateTime[] { new DateTime(2009, 01, 01) },
                               new DateTime[] { new DateTime(2009, 01, 25) });

            //TASK TWO
            AddGanttSeriesData(cdsc, "Concept Development",
                               new DateTime[] { new DateTime(2009, 01, 10) },
                               new DateTime[] { new DateTime(2009, 02, 14) });

            //TASK THREE
            AddGanttSeriesData(cdsc, "Business Analysis",
                               new DateTime[] { new DateTime(2009, 01, 21) },
                               new DateTime[] { new DateTime(2009, 02, 28) });

            //TASK FOUR
            AddGanttSeriesData(cdsc, "Market Analysis",
                               new DateTime[] { new DateTime(2009, 01, 21), new DateTime(2009, 02, 20) },
                               new DateTime[] { new DateTime(2009, 02, 12), new DateTime(2009, 03, 15) });

            //TASK FIVE
            AddGanttSeriesData(cdsc, "Implementation",
                               new DateTime[] { new DateTime(2009, 02, 10) },
                               new DateTime[] { new DateTime(2009, 04, 15) });

            //TASK SIX
            AddGanttSeriesData(cdsc, "Testing & Bug Fixes",
                               new DateTime[] { new DateTime(2009, 02, 15), new DateTime(2009, 03, 20) },
                               new DateTime[] { new DateTime(2009, 03, 15), new DateTime(2009, 04, 10) });


            //TASK SEVEN
            AddGanttSeriesData(cdsc, "Commercialize",
                               new DateTime[] { new DateTime(2009, 04, 5) },
                               new DateTime[] { new DateTime(2009, 05, 05) });

            //add task labels.
            AddGanttTaskLabels(c1Chart1, cdsc);
        }
Example #27
0
 // when the user clicks a point on the chart, select the data on the grid
 private void _chart_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         int        series         = -1;
         int        point          = -1;
         int        distance       = -1;
         ChartGroup grp            = _chart.ChartGroups[0];
         bool       foundDataPoint = grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XandYCoord, ref series, ref point, ref distance);
         if (foundDataPoint && distance < 10)
         {
             _flex.Select(point + _flex.Rows.Fixed, series + _flex.Cols.Fixed + 1);
             _flex.Focus();
         }
     }
 }
Example #28
0
        private void ConfigureLineChart(bool threed, bool stacked, FitTypeEnum fit)
        {
            ResetChart();
            ChartGroup g = c1Chart1.ChartGroups.Group0;

            g.ChartType = Chart2DTypeEnum.XYPlot;
            ChartDataSeriesCollection series = g.ChartData.SeriesList;

            g.Use3D   = threed;
            g.Stacked = stacked;

            foreach (ChartDataSeries s in series)
            {
                s.FitType = fit;
            }
        }
Example #29
0
        private void chartHistogram_DoubleClick(object sender, System.EventArgs e)
        {
            // toggle the stacking property, and adjust the bar chart clusterwidth
            // to fill each cluster when stacked, but separated when non-stacked.
            ChartGroup cg = chartHistogram.ChartGroups[0];

            if (cg.Stacked)
            {
                cg.Stacked          = false;
                cg.Bar.ClusterWidth = 50;
            }
            else
            {
                cg.Stacked          = true;
                cg.Bar.ClusterWidth = 100;
            }
        }
Example #30
0
        private void ResetChart()
        {
            categorySales1.ResetBindings(false);
            c1Chart1.ChartArea.Inverted = false;
            c1Chart1.ChartArea.AxisX.AnnotationRotation = -30;
            ChartGroup g = c1Chart1.ChartGroups.Group0;
            ChartDataSeriesCollection series = g.ChartData.SeriesList;

            foreach (ChartDataSeries s in series)
            {
                s.SymbolStyle.Shape   = SymbolShapeEnum.None;
                s.LineStyle.Thickness = 3;
                s.LineStyle.Pattern   = LinePatternEnum.Solid;
            }
            ApplyThemePalette();
            this.Alpha = 192;
        }