//------------------------------------------------------ public void Init(CChartSetup chartSetup, object objetSource) { CWin32Traducteur.Translate(this); m_panelTop.Visible = true; m_btnFiltrer.Visible = chartSetup.FormulaireFiltreAvance != null && chartSetup.FormulaireFiltreAvance.Childs.Count() > 0; m_rbtn3D.Visible = chartSetup.Autoriser3D; m_rbtnLoupe.Visible = chartSetup.AutoriserZoom; ModeSouris = EModeMouseChart.SimpleMouse; m_panelTop.Visible = m_btnFiltrer.Visible || m_rbtnLoupe.Visible || m_rbtn3D.Visible; IObjetAIContexteDonnee ob = objetSource as IObjetAIContexteDonnee; m_chartSetup = chartSetup; if (ob != null && m_chartSetup != null) { ChartSetup.IContexteDonnee = ob.IContexteDonnee; } m_chartSetup.ClearCache(); m_objetSource = objetSource; m_chartControl.ResetErreur(); if (ChartSetup != null) { ChartSetup.SetRuntimeSource(objetSource); if (ChartSetup.FormulaireFiltreSimple != null && ChartSetup.FormulaireFiltreSimple.Childs.Count() > 0) { m_panelFiltreSimple.Visible = true; m_panelFormulairefiltreSimple.InitPanel(ChartSetup.FormulaireFiltreSimple, ChartSetup); m_panelFiltreSimple.Height = ChartSetup.FormulaireFiltreSimple.Height; } else { m_panelFiltreSimple.Visible = false; } } RemplirFiltreSeries(); m_chartControl.BeginInit(); foreach (KeyValuePair <string, object> kv in m_dicValeursVariablesForcées) { SetVariableValue(kv.Key, kv.Value); } if (BeforeCalculate != null) { BeforeCalculate(this, new EventArgs()); } try { CreateAreas(); CreateLegends(); UpdateSeries(); } catch (Exception e) { m_chartControl.SetErreur(e.Message); } m_chartControl.EndInit(); }
//------------------------------------------------------ public void SetVariableValue(string strVariableName, object value) { if (strVariableName != null) { m_dicValeursVariablesForcées[strVariableName.ToUpper()] = value; if (ChartSetup != null) { ChartSetup.SetValeurChampNom(strVariableName, value); } } }
//------------------------------------------------------ public object GetVariableValue(string strVariableName) { object valeur = null; if (m_dicValeursVariablesForcées.TryGetValue(strVariableName.ToUpper(), out valeur)) { return(valeur); } if (ChartSetup != null) { return(ChartSetup.GetValeurChampNom(strVariableName)); } return(valeur); }
private static void loadGraph(ChartSetup chartSetup, ChartInfo graph) { var dataSource = chartSetup.DataSource as IList; foreach (var s in chartSetup.PrimarySeries) { dataSource.Add(s); } foreach (var s in chartSetup.SecondarySeries) { dataSource.Add(s); } chartSetup.PrimarySeries.Clear(); chartSetup.SecondarySeries.Clear(); foreach (var graphSeries in graph.Series) { var s = (chartSetup.DataSource as IList).Cast <SeriesInfo>().Where(serie => serie.Name == graphSeries.Name).First(); Debug.Assert(s != null); if (graphSeries.ShowInSecondaryVerticalAxis) { s.ShowInSecondaryVerticalAxis = true; chartSetup.SecondarySeries.Add(s); } else { s.ShowInSecondaryVerticalAxis = false; chartSetup.PrimarySeries.Add(s); } dataSource.Remove(s); } chartSetup.Refresh(); }
private void CreateNewChart_Click(object sender, EventArgs e) { csd.HideControlsForPieChart(false); ChartSetup cs = new ChartSetup(DataAccess); cs.ShowDialog(); if (cs.DialogResult == DialogResult.OK) { if (cs.IsChartForMonths) { FillChart(cs.ItemsOfXAxis, cs.ItemsOfYAxis, cs.LegendItemsNames, cs.ColorsOfYAxisItems, cs.YearOfCalculation); } else { FillChart(cs.ItemsOfXAxis, cs.ItemsOfYAxis, cs.LegendItemsNames, cs.ColorsOfYAxisItems, cs.IsProcentItems); } csd.Series = chart.Series; csd.SetSeriesGridViewRows(); csd.SetPropertiesToDefault(); } }
/// <summary> /// Creates a chart displaying a supported <see cref="ChartType"/> with the given data. Includes a chart and a table, and allows exporting the data to CSV. /// Assuming <paramref name="seriesCollection"/> has multiple elements, draws multiple sets of Y values on the same chart. /// </summary> /// <param name="setup">The setup object for the chart.</param> /// <param name="seriesCollection">The data series collection.</param> /// <param name="colors">The colors to use for the data series collection. Pass null for default colors. If you specify your own colors, the number of /// colors does not need to match the number of series. If you pass fewer colors than series, the chart will use random colors for the remaining series. /// </param> public Chart( ChartSetup setup, IEnumerable<DataSeries> seriesCollection, IEnumerable<Color> colors = null ) { this.setup = setup; this.seriesCollection = seriesCollection.ToArray(); this.colors = colors; }
/// <summary> /// Creates a chart displaying a supported <see cref="ChartType"/> with the given data. Includes a chart and a table, and allows exporting the data to CSV. /// </summary> /// <param name="setup">The setup object for the chart.</param> /// <param name="series">The data series.</param> /// <param name="color">The color to use for the data series.</param> public Chart( ChartSetup setup, DataSeries series, Color? color = null ) : this(setup, series.ToSingleElementArray(), colors: color != null ? color.Value.ToSingleElementArray() : null) { }