//------------------------------------------------------ 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 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; }