//------------------------------------------------------ private void AppliqueParametresArea(CChartArea f, ChartArea ms) { Applique3DStyle(f.Area3DStyle, ms.Area3DStyle); AppliqueAxe(f.PrimaryXAxis, ms.AxisX); AppliqueAxe(f.PrimaryYAxis, ms.AxisY); AppliqueAxe(f.SecondaryXAxis, ms.AxisX2); AppliqueAxe(f.SecondaryYAxis, ms.AxisY2); CChartAreaStyle sf = f.AreaStyle; ms.BackColor = sf.BackColor; ms.BackGradientStyle = CConvertisseurChartEnumToMSEnum.GetMSGradientStyle(sf.BackGradientStyle); ms.BackHatchStyle = CConvertisseurChartEnumToMSEnum.GetMSChartHatchStyle(sf.HatchStyle); //ms.BackImage = sf.BackImage; ms.BackImageAlignment = CConvertisseurChartEnumToMSEnum.GetMSChartImageAlignmentStyle(sf.BackImageAlignment); ms.BackImageTransparentColor = sf.BackImageTransparentColor; ms.BackImageWrapMode = CConvertisseurChartEnumToMSEnum.GetMSChartImageWrapMode(sf.BackImageWrapMode); ms.BackSecondaryColor = sf.BackSecondaryColor; ms.BorderColor = sf.BorderColor; ms.BorderDashStyle = CConvertisseurChartEnumToMSEnum.GetMSChartDashStyle(sf.BorderDashStyle); ms.BorderWidth = sf.BorderWidth; AppliqueCursor(f.CursorX, ms.CursorX); AppliqueCursor(f.CursorY, ms.CursorY); AppliquePosition(f.Position, ms.Position); ms.ShadowColor = sf.ShadowColor; ms.ShadowOffset = sf.ShadowOffset; ms.Name = f.AreaId; ms.AlignmentOrientation = CConvertisseurChartEnumToMSEnum.GetMSAreaAlignmentOrientations(f.AlignmentOrientation); ms.AlignmentStyle = CConvertisseurChartEnumToMSEnum.GetMSAreaAlignmentStyles(f.AlignmentStyle); if (f.AlignmentArea != null && f.AlignmentArea.Length > 0 && f.AlignmentArea != f.AreaId) { ms.AlignWithChartArea = f.AlignmentArea; } }
//------------------------------------------------------ private void AppliqueGridStyle(CChartGridStyle f, Grid ms) { ms.Enabled = f.Enabled; ms.Interval = f.Interval; ms.IntervalOffset = f.IntervalOffset; ms.IntervalOffsetType = CConvertisseurChartEnumToMSEnum.GetMSDateTimeIntervalType(f.IntervalOffsetType); ms.IntervalType = CConvertisseurChartEnumToMSEnum.GetMSDateTimeIntervalType(f.IntervalType); ms.LineColor = f.LineColor; ms.LineDashStyle = CConvertisseurChartEnumToMSEnum.GetMSChartDashStyle(f.LineDashStyle); ms.LineWidth = f.LineWidth; }
//--------------------------------------------------------------------- private void ApplyEmptyPointMarkerStyle(CParametreSerieDeChart pSerie, Series s) { CMarkerStyle style = pSerie.EmptyPointMarker; s.EmptyPointStyle.MarkerBorderColor = style.BorderColor; s.EmptyPointStyle.MarkerBorderWidth = style.BorderWidth; s.EmptyPointStyle.MarkerColor = style.BackColor; //s.MarkerImage = style.MarkerImage; s.EmptyPointStyle.MarkerImageTransparentColor = style.MarkerImageTransparentColor; s.EmptyPointStyle.MarkerSize = style.MarkerSize; s.EmptyPointStyle.MarkerStyle = CConvertisseurChartEnumToMSEnum.GetMSMarkerStyle(style.MarkerStyle); }
//------------------------------------------------------ //------------------------------------------------------ private void Applique3DStyle(CChart3DStyle f, ChartArea3DStyle ms) { ms.Enable3D = f.Enable3D; ms.Inclination = f.Inclination; ms.IsClustered = f.IsClustered; ms.IsRightAngleAxes = f.IsRightAngleAxes; ms.LightStyle = CConvertisseurChartEnumToMSEnum.GetMSLightStyle(f.LightStyle); ms.Perspective = f.Perspective; ms.PointDepth = f.PointDepth; ms.PointGapDepth = f.PointGapDepth; ms.Rotation = f.Rotation; ms.WallWidth = f.WallWidth; }
//------------------------------------------------------ private void AppliqueLegend(CLegendArea f, Legend ms) { ms.Alignment = CConvertisseurChartEnumToMSEnum.GetMSStringAlignment(f.Alignment); CChartLegendStyle sf = f.LegendStyle; ms.AutoFitMinFontSize = sf.AutoFitMinFontSize; ms.BackColor = sf.BackColor; ms.BackGradientStyle = CConvertisseurChartEnumToMSEnum.GetMSGradientStyle(sf.BackGradientStyle); ms.BackHatchStyle = CConvertisseurChartEnumToMSEnum.GetMSChartHatchStyle(sf.HatchStyle); //ms.BackImage = sf.BackImage; ms.BackImageAlignment = CConvertisseurChartEnumToMSEnum.GetMSChartImageAlignmentStyle(sf.BackImageAlignment); ms.BackImageTransparentColor = sf.BackImageTransparentColor; ms.BackImageWrapMode = CConvertisseurChartEnumToMSEnum.GetMSChartImageWrapMode(sf.BackImageWrapMode); ms.BackSecondaryColor = sf.BackSecondaryColor; ms.BorderColor = sf.BorderColor; ms.BorderDashStyle = CConvertisseurChartEnumToMSEnum.GetMSChartDashStyle(sf.BorderDashStyle); ms.BorderWidth = sf.BorderWidth; ms.DockedToChartArea = f.DockedArea; ms.Docking = CConvertisseurChartEnumToMSEnum.GetMSDocking(f.Docking); ms.Enabled = sf.Enabled; if (sf.Font != null) { ms.Font = sf.Font; } ms.ForeColor = sf.ForeColor; ms.InterlacedRows = sf.InterlacedRows; ms.InterlacedRowsColor = sf.InterlacedRowsColor; ms.IsDockedInsideChartArea = f.IsDockedInsideChartArea; ms.IsEquallySpacedItems = sf.IsEquallySpacedItems; ms.IsTextAutoFit = sf.IsTextAutoFit; ms.LegendItemOrder = CConvertisseurChartEnumToMSEnum.GetMSLegendItemOrder(sf.LegendItemOrder); ms.LegendStyle = CConvertisseurChartEnumToMSEnum.GetMSLegendStyle(sf.LegendStyle); ms.MaximumAutoSize = f.MaximumAutoSize; ms.Name = f.LegendId; AppliquePosition(sf.Position, ms.Position); ms.ShadowColor = sf.ShadowColor; ms.ShadowOffset = sf.ShadowOffset; ms.TableStyle = CConvertisseurChartEnumToMSEnum.GetMSLegendTableStyle(sf.TableStyle); ms.TextWrapThreshold = sf.TextWrapThreshold; ms.Title = f.Title; ms.TitleAlignment = CConvertisseurChartEnumToMSEnum.GetMSStringAlignment(f.TitleAlignment); ms.TitleBackColor = f.TitleBackColor; if (f.TitleFont != null) { ms.TitleFont = f.TitleFont; } ms.TitleForeColor = f.TitleForeColor; ms.TitleSeparator = CConvertisseurChartEnumToMSEnum.GetMSLegendSeparatorStyle(f.TitleSeparator); ms.TitleSeparatorColor = f.TitleSeparatorColor; }
//------------------------------------------------------ private void AppliqueCursor(CAxisCursor f, System.Windows.Forms.DataVisualization.Charting.Cursor ms) { ms.AutoScroll = f.AutoScroll; ms.AxisType = CConvertisseurChartEnumToMSEnum.GetMSAxisType(f.AxisType); ms.Interval = f.Interval; ms.IntervalOffset = f.IntervalOffset; ms.IntervalOffsetType = CConvertisseurChartEnumToMSEnum.GetMSDateTimeIntervalType(f.IntervalOffsetType); ms.IntervalType = CConvertisseurChartEnumToMSEnum.GetMSDateTimeIntervalType(f.IntervalType); ms.IsUserEnabled = f.IsUserEnabled; ms.IsUserSelectionEnabled = ModeSouris == EModeMouseChart.Loupe; ms.LineColor = f.LineColor; ms.LineDashStyle = CConvertisseurChartEnumToMSEnum.GetMSChartDashStyle(f.LineDashStyle); ms.LineWidth = f.LineWith; ms.SelectionColor = f.SelectionColor; }
//--------------------------------------------------------------------- private void ApplyLabelStyle(CParametreSerieDeChart pSerie, Series s) { CLabelStyle style = pSerie.LabelStyle; s.LabelAngle = style.Angle; s.LabelBackColor = style.BackColor; s.LabelBorderColor = style.BorderColor; s.LabelBorderDashStyle = CConvertisseurChartEnumToMSEnum.GetMSChartDashStyle(style.BorderDash); s.LabelBorderWidth = style.BorderWidth; s.LabelForeColor = style.ForeColor; s.LabelFormat = style.Format; if (style.Font != null) { s.Font = style.Font; } }
//------------------------------------------------------ private void AppliqueLabelStyle(CAxisLabelStyle f, LabelStyle ms) { ms.Angle = f.Angle; ms.Enabled = f.Enabled; if (f.Font != null) { ms.Font = f.Font; } ms.ForeColor = f.ForeColor; ms.Interval = f.Interval; ms.IntervalOffset = f.IntervalOffset; ms.IntervalOffsetType = CConvertisseurChartEnumToMSEnum.GetMSDateTimeIntervalType(f.IntervalOffsetType); ms.IntervalType = CConvertisseurChartEnumToMSEnum.GetMSDateTimeIntervalType(f.IntervalType); ms.IsEndLabelVisible = f.IsEndLabelVisible; ms.IsStaggered = f.IsStaggered; ms.TruncatedLabels = f.TruncatedLabels; ms.Format = f.Format; }
//------------------------------------------------------ private void AppliqueScrollBar(CScrollBarStyle f, AxisScrollBar ms) { if (f.BackColor != Color.FromArgb(0)) { ms.BackColor = f.BackColor; } if (f.ButtonColor != Color.FromArgb(0)) { ms.ButtonColor = f.ButtonColor; } ms.ButtonStyle = CConvertisseurChartEnumToMSEnum.GetMSScrollBarButtonStyles(f.ButtonStyle); ms.Enabled = f.Enabled; ms.IsPositionedInside = f.IsPositionedInside; if (f.LineColor != Color.FromArgb(0)) { ms.LineColor = f.LineColor; } ms.Size = f.Size; }
//------------------------------------------------------ private void AppliqueAxe(CChartAxis f, Axis ms) { CChartAxisStyle sf = f.Style; ms.ArrowStyle = CConvertisseurChartEnumToMSEnum.GetMSAxisArrowStyle(sf.ArrowStyle); ms.Enabled = CConvertisseurChartEnumToMSEnum.GetMSAxisEnabled(f.Enabled); ms.InterlacedColor = sf.InterlacedColor; ms.Interval = f.Interval; ms.IntervalAutoMode = CConvertisseurChartEnumToMSEnum.GetMSIntervalAutoMode(f.IntervalAutoMode); ms.IntervalOffset = f.IntervalOffset; ms.IntervalOffsetType = CConvertisseurChartEnumToMSEnum.GetMSDateTimeIntervalType(f.IntervalOffsetType); ms.IntervalType = CConvertisseurChartEnumToMSEnum.GetMSDateTimeIntervalType(f.IntervalType); ms.IsInterlaced = sf.IsInterlaced; ms.IsLabelAutoFit = f.IsLabelAutoFit; ms.IsLogarithmic = f.IsLogarithmic; ms.IsMarginVisible = f.IsMarginVisible; ms.IsMarksNextToAxis = sf.IsMarksNextToAxis; ms.IsReversed = f.IsReversed; ms.IsStartedFromZero = f.IsStartedFromZero; ms.LabelAutoFitMaxFontSize = f.LabelAutoFitMaxFontSize; ms.LabelAutoFitMinFontSize = f.LabelAutoFitMinFontSize; ms.LabelAutoFitStyle = CConvertisseurChartEnumToMSEnum.GetMSLabelAutoFitStyles(f.LabelAutoFitStyle); AppliqueLabelStyle(f.LabelStyle, ms.LabelStyle); ms.LineColor = sf.LineColor; ms.LineDashStyle = CConvertisseurChartEnumToMSEnum.GetMSChartDashStyle(sf.LineDashStyle); ms.LineWidth = sf.LineWidth; ms.LogarithmBase = f.LogarithmBase; AppliqueGridStyle(f.MajorGridStyle, ms.MajorGrid); AppliqueTickMarkerStyle(f.MajorTickMark, ms.MajorTickMark); AppliqueGridStyle(f.MinorGridStyle, ms.MinorGrid); AppliqueTickMarkerStyle(f.MinorTickMark, ms.MinorTickMark); ms.TextOrientation = CConvertisseurChartEnumToMSEnum.GetMSTextOrientation(f.TitleOrientation); ms.Title = f.Title; ms.TitleAlignment = CConvertisseurChartEnumToMSEnum.GetMSStringAlignment(f.TitleAlignment); if (f.TitleFont != null) { ms.TitleFont = f.TitleFont; } ms.TitleForeColor = f.TitleForeColor; AppliqueScrollBar(f.ScrollBar, ms.ScrollBar); }
//--------------------------------------------------------------------- private void ApplyEmptyPointStyle(CParametreSerieDeChart pSerie, Series s) { CSerieStyle style = pSerie.EmptyPointStyle; s.EmptyPointStyle.BackGradientStyle = CConvertisseurChartEnumToMSEnum.GetMSGradientStyle(style.BackGradientStyle); s.EmptyPointStyle.BackHatchStyle = CConvertisseurChartEnumToMSEnum.GetMSChartHatchStyle(style.BackHatchStyle); s.EmptyPointStyle.BackImageAlignment = CConvertisseurChartEnumToMSEnum.GetMSChartImageAlignmentStyle(style.BackImageAlignment); s.EmptyPointStyle.BackImageTransparentColor = style.BackImageTransparentColor; s.EmptyPointStyle.BackImageWrapMode = CConvertisseurChartEnumToMSEnum.GetMSChartImageWrapMode(style.BackImageWrapMode); s.EmptyPointStyle.BackSecondaryColor = style.BackSecondaryColor; s.EmptyPointStyle.BorderColor = style.BorderColor; s.EmptyPointStyle.BorderDashStyle = CConvertisseurChartEnumToMSEnum.GetMSChartDashStyle(style.BorderDashStyle); s.EmptyPointStyle.BorderWidth = style.BorderWidth; if (style.SerieColor.ToArgb() != 0) { s.EmptyPointStyle.Color = Color.FromArgb(style.SerieOpacity * 255 / 100, style.SerieColor); } else { s.EmptyPointStyle.Color = s.Color; } }
//------------------------------------------------------------------------- private void UpdateSeries() { m_bIsCheckingFiltresSeries = true; HashSet <string> areasToHide = new HashSet <string>(); foreach (ChartArea a in m_chartControl.ChartAreas) { areasToHide.Add(a.Name); } m_chartControl.Series.Clear(); foreach (CParametreSerieDeChart pSerie in ChartSetup.Series) { if (!SerieIsChecked(pSerie)) { continue; } Series s = new Series(pSerie.SerieName); s.Tag = pSerie; s.ChartType = CConvertisseurChartEnumToMSEnum.GetMSChartType(pSerie.ChartType); s.XAxisType = CConvertisseurChartEnumToMSEnum.GetMSAxisType(pSerie.XAxisType); s.YAxisType = CConvertisseurChartEnumToMSEnum.GetMSAxisType(pSerie.YAxisType); s.IsXValueIndexed = pSerie.IsValueIndexed; s.ToolTip = ""; if (pSerie.ChartArea != null && pSerie.ChartArea.Length > 0) { foreach (ChartArea a in m_chartControl.ChartAreas) { if (a.Name == pSerie.ChartArea) { s.ChartArea = a.Name; } ; } } s.Legend = pSerie.LegendArea; s.IsVisibleInLegend = pSerie.ShowInLegend; if (pSerie.LegendLabel.Length > 0) { s.LegendText = pSerie.LegendLabel; } if (pSerie.LegendTooltip.Length > 0) { s.LegendToolTip = pSerie.LegendTooltip; } s.XValueType = CConvertisseurChartEnumToMSEnum.GetMSChartValueType(pSerie.XValueType); s.YValueType = CConvertisseurChartEnumToMSEnum.GetMSChartValueType(pSerie.YValueType); List <double> lstX = GetValues <double>(pSerie.XValues, Double.NaN); List <List <double> > lstY = new List <List <double> >(); lstY.Add(GetValues <double>(pSerie.Y1Values, Double.NaN)); lstY.Add(GetValues <double>(pSerie.Y1Values, Double.NaN)); lstY.Add(GetValues <double>(pSerie.Y2Values, Double.NaN)); lstY.Add(GetValues <double>(pSerie.Y3Values, Double.NaN)); List <string> lstLabels = GetValues <string>(pSerie.LabelValues); List <string> lstAxisValues = GetValues <string>(pSerie.AxisLabelValues); List <string> lstTooltips = GetValues <string>(pSerie.ToolTipValues); List <object> lstValeursAction = GetValues <object>(pSerie.ActionValues); List <object> lstValeursSort = GetValues <object>(pSerie.SortValues); List <object> lstIncludePoint = GetValues <object>(pSerie.IncludePointValues); if (pSerie.XValues == null || lstX.Count == 0) { //Ajoute des indices en fonction des valeurs d'axe for (int nIndex = 0; nIndex < lstAxisValues.Count; nIndex++) { lstX.Add(nIndex); } } List <CFuturocomDataPoint> lstPoints = new List <CFuturocomDataPoint>(); bool bAllNull = true; for (int n = 0; n < lstX.Count; n++) { bool bNullPoint = false; List <double> vals = new List <double>(); foreach (List <double> lstVals in lstY) { if (n < lstVals.Count) { vals.Add(lstVals[n]); if (Double.IsNaN(lstVals[n])) { bNullPoint = true; } } else if (lstVals.Count > 0) { vals.Add(0); } } bool bInclude = true; if (n < lstIncludePoint.Count) { if (lstIncludePoint[n] is bool && !((bool)lstIncludePoint[n])) { bInclude = false; } } if (bInclude) { CFuturocomDataPoint pt = new CFuturocomDataPoint(); pt.XValue = lstX[n]; if (!bNullPoint) { bAllNull = false; pt.YValues = vals.ToArray(); } else { pt.IsEmpty = true; } if (n < lstLabels.Count) { pt.Label = lstLabels[n] == null ? "" : lstLabels[n]; } if (n < lstAxisValues.Count) { pt.AxisLabel = lstAxisValues[n] == null ? "" : lstAxisValues[n]; } if (n < lstTooltips.Count) { pt.CustomToolTip = lstTooltips[n] == null ? "" : lstTooltips[n]; } if (n < lstValeursAction.Count) { pt.ValeurPourAction = lstValeursAction[n]; } if (n < lstValeursSort.Count) { pt.ValeurSort = lstValeursSort[n]; } lstPoints.Add(pt); } } if (bAllNull) { lstPoints.Clear(); } lstPoints.Sort(new CPointSorter()); foreach (CFuturocomDataPoint pt in lstPoints) { s.Points.Add(pt); } if (s.Points.Count != 0) { if (s.ChartArea != null && s.ChartArea != "") { areasToHide.Remove(s.ChartArea); } else { areasToHide.Remove(m_chartControl.ChartAreas[0].Name); } ApplyMarkerStyle(pSerie, s); ApplySerieStyle(pSerie, s); ApplyLabelStyle(pSerie, s); ApplyEmptyPointStyle(pSerie, s); ApplyEmptyPointMarkerStyle(pSerie, s); m_chartControl.Series.Add(s); //m_chartControl.DataManipulator.Sort(new CPointSorter(), s); foreach (ListViewItem item in m_wndListeSeries.Items) { if (item.Tag == pSerie) { item.ImageIndex = 0; item.ToolTipText = ""; } } } else { foreach (ListViewItem item in m_wndListeSeries.Items) { if (item.Tag == pSerie) { m_wndListeSeries.ShowItemToolTips = true; item.ImageIndex = 1; item.ToolTipText = I.T("@1 has no data|20047", item.Text); } } } } foreach (ChartArea a in m_chartControl.ChartAreas) { a.Visible = !areasToHide.Contains(a.Name); } m_bIsCheckingFiltresSeries = false; }
//------------------------------------------------------ private void AppliqueTickMarkerStyle(CChartTickMark f, TickMark ms) { AppliqueGridStyle(f, ms); ms.Size = f.Size; ms.TickMarkStyle = CConvertisseurChartEnumToMSEnum.GetMSTickMarkStyle(f.TickMarkStyle); }