/// <summary> /// Initializes a new instance of the <see cref="BudgetChart"/> class. /// </summary> /// <param name="chart">The chart<see cref="ChartControl"/></param> /// <param name="data">The data<see cref="DataBuilder"/></param> /// <param name="filter">The filter<see cref="Field"/></param> /// <param name="value">The value<see cref="Stat"/></param> /// <param name="type">The type<see cref="ChartSeriesType"/></param> public BudgetChart(ChartControl chart, DataBuilder data, Field filter, Stat value, ChartSeriesType type) { Chart = chart; DbData = data; Source = data.Source; Value = value; SeriesType = type; ConfigurePrimaryAxisLabels(Chart); if (Chart.Series != null) { Chart.Series.Clear(); } Table = DbData.Table; CarryOver = DbData.Table.AsEnumerable().Where(p => p.Field <string>("BFY").Equals("2018")).Select(p => p).CopyToDataTable(); CurrentYear = DbData.Table.AsEnumerable().Where(p => p.Field <string>("BFY").Equals("2019")).Select(p => p).CopyToDataTable(); Metric = new PrcMetric(DbData); DataMetrics = Metric.GetChartMetrics(Table, filter); CurrentYearMetrics = Metric.GetChartMetrics(CurrentYear, filter); CarryOverMetrics = Metric.GetChartMetrics(CarryOver, filter); DataSeries = GetSeriesTotals(GetMeasure(DataMetrics, Value), type); DataSeries.Type = type; CurrentYearSeries = GetSeriesTotals(GetMeasure(CurrentYearMetrics, Value), type); CurrentYearSeries.Type = type; CurrentYearSeries.Text = "Current Year"; CarryOverSeries = GetSeriesTotals(GetMeasure(CarryOverMetrics, Value), type); CarryOverSeries.Type = type; CarryOverSeries.Text = "Carry Over"; ConfigureSeries(CurrentYearSeries, Value); ConfigureSeries(CarryOverSeries, Value); Configure3DMode(Chart); ConfigurePrimaryAxisLabels(Chart); Chart.ShowLegend = true; ConfigureLegend(Chart); }
/// <summary> /// Initializes a new instance of the <see cref="BudgetChart"/> class. /// </summary> /// <param name="chart">The chart<see cref="ChartControl"/></param> /// <param name="title">The title<see cref="string[]"/></param> /// <param name="table">The table<see cref="DataTable"/></param> /// <param name="filter">The filter<see cref="Field"/></param> /// <param name="value">The value<see cref="Stat"/></param> /// <param name="type">The type<see cref="ChartSeriesType"/></param> public BudgetChart(ChartControl chart, string[] title, DataTable table, Field filter, Stat value, ChartSeriesType type) { Chart = chart; Value = value; SeriesType = type; Table = table; CarryOver = Table.AsEnumerable().Where(p => p.Field <string>("BFY").Equals("2018")).Select(p => p).CopyToDataTable(); CurrentYear = Table.AsEnumerable().Where(p => p.Field <string>("BFY").Equals("2019")).Select(p => p).CopyToDataTable(); Metric = new PrcMetric(Table, filter, filter.ToString()); DataMetrics = Metric.GetChartMetrics(Table, filter); CurrentYearMetrics = Metric.GetChartMetrics(CurrentYear, filter); CarryOverMetrics = Metric.GetChartMetrics(CarryOver, filter); DataSeries = GetSeriesTotals(GetMeasure(DataMetrics, Value), type); DataSeries.Type = type; DataSeries.Name = "Combined Years"; CurrentYearSeries = GetSeriesTotals(GetMeasure(CurrentYearMetrics, Value), type); CurrentYearSeries.Type = type; CurrentYearSeries.Text = "Current Year"; CurrentYearSeries.Name = "Current Year"; CarryOverSeries = GetSeriesTotals(GetMeasure(CarryOverMetrics, Value), type); CarryOverSeries.Type = type; CarryOverSeries.Text = "Carry Over"; CarryOverSeries.Name = "Carry Over"; Chart.ShowToolTips = true; ConfigureSeries(CurrentYearSeries, Value); ConfigureSeries(CarryOverSeries, Value); Chart.Series?.Add(CurrentYearSeries); ConfigureToolTip(CurrentYearSeries); Chart.Series?.Add(CarryOverSeries); ConfigureToolTip(CarryOverSeries); Configure3DMode(Chart); ConfigurePrimaryAxisLabels(Chart); Chart.ShowLegend = true; ConfigureLegend(Chart); }
private Telerik.Charting.ChartSeries GetRandomData(int count, ChartSeriesType seriesType) { Telerik.Charting.ChartSeries series = new Telerik.Charting.ChartSeries(); series.Type = seriesType; for (int i = 0; i < count; ++i) { series.Items.Add(new ChartSeriesItem(rand.Next(0, 100))); } return(series); }
public ChartSeries Deserialize(byte[] bytes) { ChartSeries chartSeries = new ChartSeries() { Name = null, ColorDescriptor = null, Points = new List <ChartPoint>() }; //Name StringSerialization ss = new StringSerialization(); byte[] nameLengthBytes = new byte[TypeSizes.SIZE_INT]; Array.Copy(bytes, 0, nameLengthBytes, 0, TypeSizes.SIZE_INT); int length = BitConverter.ToInt32(nameLengthBytes, 0); byte[] nameBytes = new byte[length]; Array.Copy(bytes, TypeSizes.SIZE_INT, nameBytes, 0, length); string name = ss.Deserialize(nameBytes); int typeOffset = TypeSizes.SIZE_INT + nameBytes.Length; //Type byte[] typeBytes = new byte[TypeSizes.SIZE_SHORT]; Array.Copy(bytes, typeOffset, typeBytes, 0, TypeSizes.SIZE_SHORT); ChartSeriesType seriesType = (ChartSeriesType)BitConverter.ToInt16(typeBytes, 0); int colorOffset = typeOffset + TypeSizes.SIZE_SHORT; //Color ColorDescriptorSerialization cds = new ColorDescriptorSerialization(); byte[] colorBytes = new byte[cds.SizeInBytes]; Array.Copy(bytes, colorOffset, colorBytes, 0, cds.SizeInBytes); ColorDescriptor colorDescriptor = cds.Deserialize(colorBytes); //Points ChartPointSerialization cps = new ChartPointSerialization(); int offset = colorOffset + cds.SizeInBytes; while (offset < bytes.Count()) { byte[] pointBytes = new byte[cps.SizeInBytes]; Array.Copy(bytes, offset, pointBytes, 0, cps.SizeInBytes); ChartPoint point = cps.Deserialize(pointBytes); chartSeries.Points.Add(point); offset += cps.SizeInBytes; } chartSeries.Name = name; chartSeries.Type = seriesType; chartSeries.ColorDescriptor = colorDescriptor; return(chartSeries); }
public ChartAxisValueMemberDoesNotExistException(ChartSeriesType seriesType, ChartAxisType axisType, string valueMemberPath) : base(String.Format( "The value member [{0}] for axis type [{2}] series type [{1}] does not exist in the data", valueMemberPath, seriesType, axisType )) { SeriesType = seriesType; AxisType = axisType; ValueMemberPath = valueMemberPath; }
public ChartAxisValueMemberDoesNotExistException(ChartSeriesType seriesType, ChartAxisType axisType, string valueMemberPath) : base(String.Format( "The value member [{0}] for axis type [{2}] series type [{1}] does not exist in the data", valueMemberPath, seriesType, axisType )) { SeriesType = seriesType; AxisType = axisType; ValueMemberPath = valueMemberPath; }
public InvalidChartValueMemberException(ChartSeriesType seriesType, PSPropertyInfo prop, string valueMemberPath, string viewModelMemberName) : base(String.Format( "The value member [{0}] for the [{2}] of series type [{1}] is of an invalid type [{3}].", valueMemberPath, seriesType, viewModelMemberName, null != prop ? prop.TypeNameOfValue : "null" )) { SeriesType = seriesType; Property = prop; ValueMemberPath = valueMemberPath; }
public InvalidChartAxisValueMemberException(ChartSeriesType seriesType, ChartAxisType axisType, SolidPSObjectBase data, string valueMemberPath) : base(String.Format( "The value member [{0}] of data type [{3}] is invalid for axis type [{2}] series type [{1}]", valueMemberPath, seriesType, axisType, null == data ? "null" : data.GetPropTypeName(valueMemberPath) )) { SeriesType = seriesType; AxisType = axisType; Data = data; ValueMemberPath = valueMemberPath; }
public static ChartAxisType[] ValidAxisTypes(this ChartSeriesType seriesType) { if (seriesType.IsCategorical()) { return(CategorialAxes); } if (seriesType.IsScatter()) { return(ScatterAxes); } if (seriesType.IsPolar()) { return(PolarAxes); } if (seriesType.IsRadial()) { return(RadialAxes); } return(new ChartAxisType[] { }); }
/// <summary> /// The GetSeriesTotals /// </summary> /// <param name="data">The data<see cref="Dictionary{string, double}"/></param> /// <param name="type">The type<see cref="ChartSeriesType"/></param> /// <returns>The <see cref="ChartSeries"/></returns> internal ChartSeries GetSeriesTotals(Dictionary <string, double> data, ChartSeriesType type) { try { DataSeries = new ChartSeries("Total", type); switch (type) { case ChartSeriesType.Column: foreach (KeyValuePair <string, double> kvp in data) { DataSeries.Points.Add(kvp.Key, kvp.Value); } return(DataSeries); case ChartSeriesType.Area: foreach (KeyValuePair <string, double> kvp in data) { DataSeries.Points.Add(kvp.Key, kvp.Value); } return(DataSeries); case ChartSeriesType.Pie: ArrayList list = new ArrayList(); foreach (KeyValuePair <string, double> kvp in data) { DataSeries.Points.Add(kvp.Key, kvp.Value); } return(DataSeries); } return(DataSeries); } catch (Exception e) { new Error(e).ShowDialog(); return(null); } }
/// <summary> /// Initializes a new instance of the <see cref="BudgetChart"/> class. /// </summary> /// <param name="chart">The chart<see cref="ChartControl"/></param> /// <param name="title">The title<see cref="string[]"/></param> /// <param name="source">The source<see cref="Source"/></param> /// <param name="param">The param<see cref="Dictionary{string, object}"/></param> /// <param name="filter">The filter<see cref="Field"/></param> /// <param name="value">The value<see cref="Stat"/></param> /// <param name="type">The type<see cref="ChartSeriesType"/></param> public BudgetChart(ChartControl chart, string[] title, Source source, Dictionary <string, object> param, Field filter, Stat value, ChartSeriesType type) { Chart = chart; if (Chart.Series.Count > 0) { Chart.Series.Clear(); } Configure3DMode(Chart); SeriesType = type; Source = source; Value = value; DbData = new DataBuilder(source, Provider.SQLite, param); Table = DbData.Table; Metric = new PrcMetric(DbData); DataMetrics = Metric.GetChartMetrics(Table, filter); DataSeries = GetSeriesTotals(GetMeasure(DataMetrics, Value), SeriesType); Chart.Series?.Add(DataSeries); ConfigureSeries(DataSeries, Value); ConfigurePrimaryAxisLabels(Chart); ConfigureMainTitle(title); Chart.ShowToolTips = true; }
/// <summary> /// Initializes a new instance of the <see cref="BudgetChart"/> class. /// </summary> /// <param name="chart">The chart<see cref="ChartControl"/></param> /// <param name="title">The title<see cref="string[]"/></param> /// <param name="source">The source<see cref="Source"/></param> /// <param name="filter">The filter<see cref="Field"/></param> /// <param name="value">The value<see cref="Stat"/></param> /// <param name="type">The type<see cref="ChartSeriesType"/></param> public BudgetChart(ChartControl chart, string[] title, Source source, Field filter, Stat value, ChartSeriesType type) { Chart = chart; Source = source; DbData = new DataBuilder(source, Provider.SQLite); Value = value; SeriesType = type; ConfigurePrimaryAxisLabels(Chart); ConfigureMainTitle(title); if (Chart.Series != null) { Chart.Series.Clear(); } Table = DbData.Table; Metric = new PrcMetric(DbData); DataMetrics = Metric.GetChartMetrics(Table, filter); DataSeries = GetSeriesTotals(GetMeasure(DataMetrics, Value), type); DataSeries.Type = SeriesType; ConfigureSeries(DataSeries, Value); Configure3DMode(Chart); Chart.ShowToolTips = true; }
/// <summary> /// Initializes a new instance of the <see cref="BudgetChart"/> class. /// </summary> /// <param name="chart">The chart<see cref="ChartControl"/></param> /// <param name="title">The title<see cref="string[]"/></param> /// <param name="data">The data<see cref="Dictionary{string, double}"/></param> /// <param name="filter">The filter<see cref="Field"/></param> /// <param name="value">The value<see cref="Stat"/></param> /// <param name="type">The type<see cref="ChartSeriesType"/></param> public BudgetChart(ChartControl chart, string[] title, Dictionary <string, double> data, Field filter, Stat value, ChartSeriesType type) { Chart = chart; Value = value; SeriesType = type; if (Chart.Series.Count > 0) { Chart.Series.Clear(); } DataSeries = new ChartSeries(); ConfigureSeries(DataSeries, Value); DataSeries.Type = SeriesType; foreach (KeyValuePair <string, double> kvp in data) { DataSeries.Points.Add(kvp.Key, kvp.Value); } Chart.Series?.Add(DataSeries); Configure3DMode(Chart); ConfigurePrimaryAxisLabels(Chart); ConfigureMainTitle(title); Chart.ShowToolTips = true; }
public DnnChartSeries(string name, ChartSeriesType type) : base(name, type) { }
public InvalidChartValueMemberException(ChartSeriesType seriesType, PSPropertyInfo prop, string valueMemberPath, string viewModelMemberName) : base(String.Format( "The value member [{0}] for the [{2}] of series type [{1}] is of an invalid type [{3}].", valueMemberPath, seriesType, viewModelMemberName, null != prop ? prop.TypeNameOfValue : "null" )) { SeriesType = seriesType; Property = prop; ValueMemberPath = valueMemberPath; }
public InvalidChartAxisValueMemberException(ChartSeriesType seriesType, ChartAxisType axisType, SolidPSObjectBase data, string valueMemberPath) : base(String.Format( "The value member [{0}] of data type [{3}] is invalid for axis type [{2}] series type [{1}]", valueMemberPath, seriesType, axisType, null == data ? "null" : data.GetPropTypeName( valueMemberPath ) )) { SeriesType = seriesType; AxisType = axisType; Data = data; ValueMemberPath = valueMemberPath; }
public static bool IsCategoricalRange(this ChartSeriesType seriesType) { return(CategoricalRangeSeries.Contains(seriesType)); }
private void TranslateChartType(Microsoft.ReportingServices.ReportProcessing.Chart.ChartTypes chartType, Microsoft.ReportingServices.ReportProcessing.Chart.ChartSubTypes chartSubType) { ChartSeriesType value = ChartSeriesType.Column; ChartSeriesSubtype value2 = ChartSeriesSubtype.Plain; if (m_plotAsLine && chartType != Microsoft.ReportingServices.ReportProcessing.Chart.ChartTypes.Line) { value = ChartSeriesType.Line; value2 = ChartSeriesSubtype.Plain; } else { switch (chartType) { case Microsoft.ReportingServices.ReportProcessing.Chart.ChartTypes.Area: value = ChartSeriesType.Area; value2 = TranslateChartSubType(chartSubType); break; case Microsoft.ReportingServices.ReportProcessing.Chart.ChartTypes.Bar: value = ChartSeriesType.Bar; value2 = TranslateChartSubType(chartSubType); break; case Microsoft.ReportingServices.ReportProcessing.Chart.ChartTypes.Column: value = ChartSeriesType.Column; value2 = TranslateChartSubType(chartSubType); break; case Microsoft.ReportingServices.ReportProcessing.Chart.ChartTypes.Line: value = ChartSeriesType.Line; value2 = TranslateChartSubType(chartSubType); break; case Microsoft.ReportingServices.ReportProcessing.Chart.ChartTypes.Pie: value = ChartSeriesType.Shape; value2 = ((chartSubType != Microsoft.ReportingServices.ReportProcessing.Chart.ChartSubTypes.Exploded) ? ChartSeriesSubtype.Pie : ChartSeriesSubtype.ExplodedPie); break; case Microsoft.ReportingServices.ReportProcessing.Chart.ChartTypes.Doughnut: value = ChartSeriesType.Shape; value2 = ((chartSubType != Microsoft.ReportingServices.ReportProcessing.Chart.ChartSubTypes.Exploded) ? ChartSeriesSubtype.Doughnut : ChartSeriesSubtype.ExplodedDoughnut); break; case Microsoft.ReportingServices.ReportProcessing.Chart.ChartTypes.Scatter: if (chartSubType == Microsoft.ReportingServices.ReportProcessing.Chart.ChartSubTypes.Plain) { value = ChartSeriesType.Scatter; value2 = ChartSeriesSubtype.Plain; } else { value = ChartSeriesType.Line; value2 = ((chartSubType != Microsoft.ReportingServices.ReportProcessing.Chart.ChartSubTypes.Line) ? ChartSeriesSubtype.Smooth : ChartSeriesSubtype.Plain); } break; case Microsoft.ReportingServices.ReportProcessing.Chart.ChartTypes.Bubble: value = ChartSeriesType.Scatter; value2 = ChartSeriesSubtype.Bubble; break; case Microsoft.ReportingServices.ReportProcessing.Chart.ChartTypes.Stock: value = ChartSeriesType.Range; value2 = TranslateChartSubType(chartSubType); break; } } m_chartSeriesType = new ReportEnumProperty <ChartSeriesType>(value); m_chartSeriesSubtype = new ReportEnumProperty <ChartSeriesSubtype>(value2); }
public DnnChartSeries(string name, ChartSeriesType type) : base(name, type) { }
public DnnChartSeries(string seriesName, ChartSeriesType chartSeriesType, ChartSeriesCollection parent, ChartYAxisType yAxisType, StyleSeries style, string dataYColumn, string dataXColumn, string dataYColumn2, string dataXColumn2, string dataYColumn3, string dataYColumn4, string dataLabelsColumn) : base(seriesName, chartSeriesType, parent, yAxisType, style, dataYColumn, dataXColumn, dataYColumn2, dataXColumn2, dataYColumn3, dataYColumn4, dataLabelsColumn) { }
private void TranslateChartType(AspNetCore.ReportingServices.ReportProcessing.Chart.ChartTypes chartType, AspNetCore.ReportingServices.ReportProcessing.Chart.ChartSubTypes chartSubType) { ChartSeriesType value = ChartSeriesType.Column; ChartSeriesSubtype value2 = ChartSeriesSubtype.Plain; if (this.m_plotAsLine && chartType != AspNetCore.ReportingServices.ReportProcessing.Chart.ChartTypes.Line) { value = ChartSeriesType.Line; value2 = ChartSeriesSubtype.Plain; } else { switch (chartType) { case AspNetCore.ReportingServices.ReportProcessing.Chart.ChartTypes.Area: value = ChartSeriesType.Area; value2 = this.TranslateChartSubType(chartSubType); break; case AspNetCore.ReportingServices.ReportProcessing.Chart.ChartTypes.Bar: value = ChartSeriesType.Bar; value2 = this.TranslateChartSubType(chartSubType); break; case AspNetCore.ReportingServices.ReportProcessing.Chart.ChartTypes.Column: value = ChartSeriesType.Column; value2 = this.TranslateChartSubType(chartSubType); break; case AspNetCore.ReportingServices.ReportProcessing.Chart.ChartTypes.Line: value = ChartSeriesType.Line; value2 = this.TranslateChartSubType(chartSubType); break; case AspNetCore.ReportingServices.ReportProcessing.Chart.ChartTypes.Pie: value = ChartSeriesType.Shape; value2 = (ChartSeriesSubtype)((chartSubType != AspNetCore.ReportingServices.ReportProcessing.Chart.ChartSubTypes.Exploded) ? 5 : 6); break; case AspNetCore.ReportingServices.ReportProcessing.Chart.ChartTypes.Doughnut: value = ChartSeriesType.Shape; value2 = (ChartSeriesSubtype)((chartSubType != AspNetCore.ReportingServices.ReportProcessing.Chart.ChartSubTypes.Exploded) ? 7 : 8); break; case AspNetCore.ReportingServices.ReportProcessing.Chart.ChartTypes.Scatter: if (chartSubType == AspNetCore.ReportingServices.ReportProcessing.Chart.ChartSubTypes.Plain) { value = ChartSeriesType.Scatter; value2 = ChartSeriesSubtype.Plain; } else { value = ChartSeriesType.Line; value2 = (ChartSeriesSubtype)((chartSubType != AspNetCore.ReportingServices.ReportProcessing.Chart.ChartSubTypes.Line) ? 3 : 0); } break; case AspNetCore.ReportingServices.ReportProcessing.Chart.ChartTypes.Bubble: value = ChartSeriesType.Scatter; value2 = ChartSeriesSubtype.Bubble; break; case AspNetCore.ReportingServices.ReportProcessing.Chart.ChartTypes.Stock: value = ChartSeriesType.Range; value2 = this.TranslateChartSubType(chartSubType); break; } } this.m_chartSeriesType = new ReportEnumProperty <ChartSeriesType>(value); this.m_chartSeriesSubtype = new ReportEnumProperty <ChartSeriesSubtype>(value2); }
public static bool IsScatter(this ChartSeriesType seriesType) { return(ScatterSeries.Contains(seriesType)); }
public static bool IsPolar(this ChartSeriesType seriesType) { return(PolarSeries.Contains(seriesType)); }
public DnnChartSeries(string seriesName, ChartSeriesType chartSeriesType, ChartSeriesCollection parent, ChartYAxisType yAxisType, StyleSeries style) : base(seriesName, chartSeriesType, parent, yAxisType, style) { }
public InvalidChartAxisTypeException(ChartSeriesType seriesType, ChartAxisType axisType) : base(String.Format("Invalid axis type [{0}] for series type [{1}]", axisType, seriesType)) { SeriesType = seriesType; AxisType = axisType; }
public DnnChartSeries(string name, ChartSeriesType type, ChartSeriesCollection parent) : base(name, type, parent) { }
/// <summary> /// Returns a data series of the given data. /// </summary> /// <param name="x">The x data.</param> /// <param name="y">The y data.</param> /// <param name="type">The chart type.</param> /// <param name="marker">The marker style to use.</param> /// <returns>A new data series.</returns> /// <exception cref="MismatchedSizeException">Thrown if x and y have different lengths.</exception> protected static ChartSeries BindXY( IDFColumn x, IDFColumn y, ChartSeriesType type, ChartSymbolShape marker ) { if( x.Count != y.Count ) { throw new MismatchedSizeException( "x,y column of unequal length", x.Count, y.Count ); } ChartSeries series = new ChartSeries() { Type = type, }; series.Style.Symbol.Shape = marker; if( x is DFNumericColumn && y is DFNumericColumn ) { for( int i = 0; i < x.Count; i++ ) { series.Points.Add( (double)x[i], (double)y[i] ); } } else if( x is DFNumericColumn && y is DFIntColumn ) { for( int i = 0; i < x.Count; i++ ) { series.Points.Add( (double)x[i], (int)y[i] ); } } else if( x is DFIntColumn && y is DFNumericColumn ) { for( int i = 0; i < x.Count; i++ ) { series.Points.Add( (int)x[i], (double)y[i] ); } } else if( x is DFIntColumn && y is DFIntColumn ) { for( int i = 0; i < x.Count; i++ ) { series.Points.Add( (int)x[i], (int)y[i] ); } } else if( x.IsNumeric && y.IsNumeric ) { for( int i = 0; i < x.Count; i++ ) { series.Points.Add( Double.Parse( x[i].ToString() ), Double.Parse( y[i].ToString() ) ); } } else { throw new Core.InvalidArgumentException( "Column must be numeric." ); } return series; }
public DnnChartSeries(string seriesName, ChartSeriesType chartSeriesType, ChartSeriesCollection parent, ChartYAxisType yAxisType, StyleSeries style) : base(seriesName, chartSeriesType, parent, yAxisType, style) { }
public Theme CreateTheme(string p_IndicatorNId, string p_UnitNId, string p_SubgroupValNId, ThemeType p_ThemeType, ChartType chartType, ChartSeriesType chartGroupBy, int p_Position) { //*** Create New Theme. Theme RetVal = null; string sSubgroupValNId = string.Empty; string sRowFilter = string.Empty; string DefaultIndicatorNId = string.Empty; string DefaultUnitNId = string.Empty; foreach (Theme _TempTheme in m_Themes) { if (_TempTheme.ID == p_IndicatorNId + "_" + p_UnitNId + "_" + p_SubgroupValNId + "_" + ((int)p_ThemeType).ToString()) { //If theme already exists exception will be thrown throw new ApplicationException("3"); //TODO return null or some other approach } } Theme _Theme = new Theme(); DataView _ThemeData; //-- If indicatorNID and UnitNId are -1 ,then Get default indicatorNId , UnitNIds from PresentationData's first row. //-- It is required because, for creating any theme (Chart or color) first time, we need some indicator, unit NIDs. if (p_IndicatorNId == "-1") { DefaultIndicatorNId = this.MRDData[0][Indicator.IndicatorNId].ToString(); sRowFilter += Indicator.IndicatorNId + " IN (" + DefaultIndicatorNId + ")"; } else { sRowFilter += Indicator.IndicatorNId + " IN (" + p_IndicatorNId + ")"; DefaultIndicatorNId = p_IndicatorNId; } if (p_UnitNId == "-1") { DefaultUnitNId = this.MRDData[0][Unit.UnitNId].ToString(); sRowFilter += " AND " + Unit.UnitNId + " IN (" + DefaultUnitNId + ")"; } else { sRowFilter += " AND " + Unit.UnitNId + " IN (" + p_UnitNId + ")"; DefaultUnitNId = p_UnitNId; } //DataTable SubGroupDataTable = DIConnection.ExecuteDataTable(DIQueries.IUS.GetSubgroupValByIU(Convert.ToInt32(DefaultIndicatorNId), Convert.ToInt32(DefaultUnitNId))); if (p_ThemeType == ThemeType.Chart) { string sSql = string.Empty; //foreach (DataRow dr in SubGroupDataTable.Rows) foreach (DataRow dr in this.GetSubgroupsNIDsBy_IndicatorUnit(DefaultIndicatorNId, DefaultUnitNId).Rows) { if (sSubgroupValNId.Length > 0) { sSubgroupValNId += ","; } sSubgroupValNId += dr[SubgroupVals.SubgroupValNId].ToString(); } if (!string.IsNullOrEmpty(sSubgroupValNId)) { //Get all records for Selected Indicator, Subgroups and Unit sRowFilter = Indicator.IndicatorNId + " IN (" + DefaultIndicatorNId + ") AND " + Unit.UnitNId + " IN (" + DefaultUnitNId + ") AND " + SubgroupVals.SubgroupValNId + " IN (" + sSubgroupValNId + ")"; } else { sRowFilter = Indicator.IndicatorNId + " IN (" + DefaultIndicatorNId + ") AND " + Unit.UnitNId + " IN (" + DefaultUnitNId + ")"; } //////-- If Pie chart, then TimeSeries shud be OFF. Use MRD data ////if (chartType == ChartType.Pie) ////{ //// this.MRDData.RowFilter = sRowFilter; //// _ThemeData = new DataView(this.MRDData.ToTable()); //// this.MRDData.RowFilter = ""; ////} ////else ////{ //// this.PresentationData.RowFilter = sRowFilter; //// _ThemeData = new DataView(this.PresentationData.ToTable()); //// this.PresentationData.RowFilter = ""; ////} this.PresentationData.RowFilter = sRowFilter; _ThemeData = new DataView(this.PresentationData.ToTable()); this.PresentationData.RowFilter = ""; } else { //_ThemeData = m_QueryBase.Map_GetData(int.Parse(p_IndicatorNId), int.Parse(p_UnitNId), int.Parse(p_Subgroup_NId), 0, -1); //_ThemeData = this.MRDData; if (p_SubgroupValNId == "-1") { //-- Set Subgroup filter only for new theme case. //-- In case of Subgroup = Select all case discard subgroup filter if (p_IndicatorNId == "-1" && p_UnitNId == "-1" && p_SubgroupValNId == "-1") { sRowFilter += " AND " + SubgroupVals.SubgroupValNId + " IN (" + MRDData[0][SubgroupVals.SubgroupValNId] + ")"; } else { //-- SubgroupNid = -1 and IndicatorNid <> -1 , indicates that Subgroup = "Select ALL" case. //-- then set bool variable of Theme.SubgroupSelectAll = true _Theme.SubgroupSelectAll = true; } } else { sRowFilter += " AND " + SubgroupVals.SubgroupValNId + " IN (" + p_SubgroupValNId + ")"; } this.MRDData.RowFilter = sRowFilter; _ThemeData = new DataView(this.MRDData.ToTable()); this.MRDData.RowFilter = ""; } //--Ckeck if Theme Data Has some record. Exit function if NO record Found. if (_ThemeData.Count > 0) { //*** Add Metadata Columns int i; if (_ThemeData.Count == 0) { throw new ApplicationException("5"); } //*** Update Metadata Column values if metadata column exists //UpdateMetadataInfo(ref _ThemeData); //GenerateLayerInformation(_Theme, _ThemeData) foreach (Layer _Layer in m_Layers) { { if (!_Theme.LayerVisibility.ContainsKey(_Layer.ID)) { switch (_Layer.LayerType) { case ShapeType.Point: case ShapeType.Polygon: case ShapeType.PolyLine: _Theme.LayerVisibility.Add(_Layer.ID, true); break; case ShapeType.PointFeature: case ShapeType.PolygonFeature: case ShapeType.PolyLineFeature: _Theme.LayerVisibility.Add(_Layer.ID, false); break; } } } } // _Layer = null; //object[] oMDKeys = new object[MDKeys.Keys.Count]; //MDKeys.Keys.CopyTo(oMDKeys, 0); object[] oMDKeys = this.MDColumns; _Theme.MetaDataKeys = oMDKeys; _Theme.Type = p_ThemeType; //_Theme.LegendTitle = _ThemeData[0][Unit.UnitName].ToString();; _Theme.SetLegendTitle(_ThemeData[0][Indicator.IndicatorName].ToString(), _ThemeData[0][Unit.UnitName].ToString(), _ThemeData[0][SubgroupVals.SubgroupVal].ToString()); //*** Bugfix 26 Apr 2006 For the second map theme, the legend doesn’t automatically append a title… _Theme.StartColor = m_FirstColor; _Theme.EndColor = m_FourthColor; if ((m_Layers.RecordCounts() == 0) || m_Layers.RecordCounts() == 0) { _Theme.ShapeCount = m_Layers.RecordCounts(m_SpatialMapFolder); } else { _Theme.ShapeCount = m_Layers.RecordCounts(); } _Theme.MissingColor = this._MissingColor; switch (_Theme.Type) { case ThemeType.Color: _Theme.SetRange(_ThemeData); _Theme.Legends[0].Color = FirstColor; _Theme.Legends[1].Color = SecondColor; _Theme.Legends[2].Color = ThirdColor; _Theme.Legends[3].Color = FourthColor; _Theme.Legends[_Theme.Legends.Count - 1].Caption = m_MissingValue; _Theme.BreakType = BreakType.Continuous; //$$$ By Default create the theme on the basis of equal count and set it as continuous break; case ThemeType.Hatch: _Theme.SetRange(_ThemeData); _Theme.Legends[0].Color = Color.LightGray; _Theme.Legends[1].Color = Color.LightGray; _Theme.Legends[2].Color = Color.LightGray; _Theme.Legends[3].Color = Color.LightGray; _Theme.Legends[_Theme.Legends.Count - 1].Caption = m_MissingValue; _Theme.BreakType = BreakType.Continuous; //$$$ By Default create the theme on the basis of equal count and set it as continuous break; case ThemeType.Symbol: _Theme.SetRange(_ThemeData); for (i = 0; i <= _Theme.Legends.Count - 1; i++) { _Theme.Legends[i].MarkerType = MarkerStyle.Custom; _Theme.Legends[i].MarkerChar = Strings.Chr(110); //-- (65 + i) - previous used if (i <= 3) { //-- Default color is red for all with 50% transparency _Theme.Legends[i].Color = Color.FromArgb(128, 255, 0, 0); _Theme.Legends[i].MarkerFont = new Font("Webdings", 10 + i * 5); _Theme.Legends[i].MarkerSize = 10 + i * 5; } else { //-- Missing legend info _Theme.Legends[i].Color = Color.FromArgb(128, _Theme.MissingColor); _Theme.Legends[i].MarkerFont = new Font("Webdings", 10); _Theme.Legends[i].MarkerSize = 10; } } _Theme.Legends[_Theme.Legends.Count - 1].Caption = m_MissingValue; _Theme.BreakType = BreakType.Continuous; //$$$ By Default create the theme on the basis of equal count and set it as continuous break; case ThemeType.Label: _Theme.SetRange(_ThemeData); Font fnt = new Font("Arial", 8); for (i = 0; i <= _Theme.Legends.Count - 1; i++) { switch (i) { case 0: _Theme.Legends[i].Color = Color.FromArgb(255 - FirstColor.R, 255 - FirstColor.G, 255 - FirstColor.B); break; case 1: _Theme.Legends[i].Color = Color.FromArgb(255 - SecondColor.R, 255 - SecondColor.G, 255 - SecondColor.B); break; case 2: _Theme.Legends[i].Color = Color.FromArgb(255 - ThirdColor.R, 255 - ThirdColor.G, 255 - ThirdColor.B); break; case 3: _Theme.Legends[i].Color = Color.FromArgb(255 - FourthColor.R, 255 - FourthColor.G, 255 - FourthColor.B); break; default: //Missing Data _Theme.Legends[i].Color = Color.LightYellow; break; } _Theme.Legends[i].MarkerFont = fnt; } _Theme.Legends[_Theme.Legends.Count - 1].Caption = m_MissingValue; _Theme.BreakType = BreakType.Continuous; //$$$ By Default create the theme on the basis of equal count and set it as continuous break; case ThemeType.DotDensity: _Theme.DotSize = 3; _Theme.SetThemeId(ref _ThemeData); CalcDotDensity(_ThemeData, ref _Theme); break; case ThemeType.Chart: //-- Chart dataValue are plotted against multiple SubgroupVal OR Sources. _Theme.ChartSeriestype = chartGroupBy; _Theme.ChartType = chartType; //-- Get SubgroupValNIDs which are available in ThemeData sSubgroupValNId = string.Empty; // foreach (DataRow drow in SubGroupDataTable.Rows) foreach (DataRow drow in _ThemeData.ToTable(true, SubgroupVals.SubgroupValNId).Rows) { if (sSubgroupValNId.Length == 0) { sSubgroupValNId = drow[SubgroupVals.SubgroupValNId].ToString(); } else { sSubgroupValNId += "," + drow[SubgroupVals.SubgroupValNId].ToString(); } } string[] _Inds = Strings.Split(DefaultIndicatorNId, ",", -1, CompareMethod.Text); string[] _SPs = Strings.Split(sSubgroupValNId, ",", -1, CompareMethod.Text); //*** Bugfix 15 June 2006 Improper Max data value for Chart theme type //float MinVal = 0; //float MaxVal = 0; //GetMinMaxDataValue(ref _ThemeData, ref MinVal, ref MaxVal); //_Theme.Minimum = MinVal; //_Theme.Maximum = MaxVal; _ThemeData.Sort = DataExpressionColumns.DataType + " ASC," + DataExpressionColumns.NumericData + " ASC"; _Theme.Minimum = (decimal)_ThemeData[0][DataExpressionColumns.NumericData]; _Theme.Maximum = (decimal)_ThemeData[_ThemeData.Count - 1][DataExpressionColumns.NumericData]; if (chartGroupBy == ChartSeriesType.Subgroup) { //-- ChartGroupBy will be Subgroup by default. MakeChartTheme(_Inds, _SPs, _ThemeData, _Theme); } if (_Theme.ChartType != ChartType.Line) { _Theme.DisplayChartMRD = true; //-- default } //color array string[] _IndColor = new string[_Inds.Length]; VBMath.Randomize(); for (i = 0; i <= _Inds.Length - 1; i++) { //Initially it was VBMath.rnd() function using for getting random no. _IndColor[i] = Color.FromArgb((int)(_random.NextDouble() * 255), (int)(_random.NextDouble() * 255), (int)(_random.NextDouble() * 255)).Name; } string _INDName = ""; string _INDNid = ""; string _SPName = ""; string _SPNId = ""; string sSql = DIQueries.IUS.GetIUSNIdByI_U_S(DefaultIndicatorNId, "", ""); System.Data.IDataReader dr = DIConnection.ExecuteReader(sSql); string sIUSNIds = string.Empty; while (dr.Read()) { if (sIUSNIds.Length > 0) sIUSNIds += ","; sIUSNIds += dr[Indicator_Unit_Subgroup.IUSNId].ToString(); } dr.Close(); dr.Dispose(); sSql = DIQueries.IUS.GetIUS(FilterFieldType.NId, sIUSNIds, FieldSelection.Light); DataView _Dv = DIConnection.ExecuteDataTable(sSql).DefaultView; //DataView _Dv = m_QueryBase.Indicator_GetIUSSelections(p_IndicatorNId, sSubgroup_NId, -1); //Default p_UnitNId = -1 is passed as defined in function signaure. string[] SubGroupArr; SubGroupArr = sSubgroupValNId.Split(','); for (i = 0; i <= SubGroupArr.Length - 1; i++) { _Dv.RowFilter = "Subgroup_Val_NId = " + SubGroupArr[i]; if (_INDNid.IndexOf("{~}" + _Dv[0]["Indicator_NId"].ToString() + "@") == -1) { if (_INDName.Length > 0) _INDName += "{~}"; _INDNid += "{~}"; _INDName += _Dv[0]["Indicator_Name"].ToString(); _INDNid += _Dv[0]["Indicator_NId"].ToString() + "@"; _Theme.UnitName = _Dv[0]["Unit_Name"].ToString(); } if (_SPNId.IndexOf("{~}" + _Dv[0]["Subgroup_Val_NId"].ToString() + "@") == -1) { if (_SPName.Length > 0) _SPName += "{~}"; _SPNId += "{~}"; _SPName += _Dv[0]["Subgroup_Val"].ToString(); _SPNId += _Dv[0]["Subgroup_Val_NId"].ToString() + "@"; } } _INDNid = _INDNid.Replace("@", ""); _SPNId = _SPNId.Replace("@", ""); _Theme.IndicatorName = Strings.Split(_INDName, "{~}", -1, CompareMethod.Text); _Theme.IndicatorNId = Strings.Split(_INDNid, "{~}", -1, CompareMethod.Text); _Theme.SubgroupName = Strings.Split(_SPName, "{~}", -1, CompareMethod.Text); _Theme.SubgroupNId = Strings.Split(_SPNId, "{~}", -1, CompareMethod.Text); _Theme.UnitNId = int.Parse(DefaultUnitNId); //p_unitNid _Theme.IndicatorColor = _IndColor; p_IndicatorNId = DefaultIndicatorNId; p_UnitNId = DefaultUnitNId; string[] _SPFill = new string[_Theme.SubgroupName.Length]; string[] _SPVisible = new string[_Theme.SubgroupName.Length]; for (i = 0; i <= _Theme.SubgroupName.Length - 1; i++) { //Initiallly it was VBMath.rnd() function using for getting random no. //-- Default transparency is 60% i.e 153 value. _SPFill[i] = Color.FromArgb(153, (int)(_random.NextDouble() * 255), (int)(_random.NextDouble() * 255), (int)(_random.NextDouble() * 255)).ToArgb().ToString(); _SPVisible[i] = "1"; } _Theme.SubgroupFillStyle = _SPFill; _Theme.SubgroupVisible = _SPVisible; //--If ChartGroupBy = source, then update Chart accordingly if (chartGroupBy == ChartSeriesType.Source) { //-- Take default subgroupNId string SubgroupNIdForSource = p_SubgroupValNId; if (SubgroupNIdForSource == "-1") { //-- Take first subgroup in collection SubgroupNIdForSource = _Theme.SubgroupNId[0]; } this.UpdateChartForMultipleSource(SubgroupNIdForSource, ref _Theme); } break; } if (p_IndicatorNId == "-1" & p_UnitNId == "-1" & p_SubgroupValNId == "-1") { } else { if (p_UnitNId == "-1") { _Theme.UnitNId = -1; } if (p_SubgroupValNId == "-1" && _Theme.SubgroupNId.Length > 0 && _Theme.SubgroupNId[0] == "-1") { string[] SNID = new string[1]; SNID[0] = "-1"; _Theme.SubgroupNId = SNID; } _Theme.ID = p_IndicatorNId + "_" + p_UnitNId + "_" + p_SubgroupValNId + "_" + (int)p_ThemeType; //$$$ Convention for Theme Id -> I_U_S_ThemeType } //-- Save GIDs of Indicator, Unit, Subgroups used in theme creation. _Theme.I_U_S_GIDs = this.GetI_U_S_GIDsByNids(this.DIDataView.MainDataTable.DefaultView, DefaultIndicatorNId, DefaultUnitNId, _Theme.SubgroupNId[0]); if (p_Position == -1) { m_Themes.Add(_Theme); } else { m_Themes.Insert(p_Position, _Theme); } } //- Apply Default setting of Map.TemplateStyle if (this.TemplateStyle != null) { _Theme.LegendFont = new Font(this.TemplateStyle.LegendTitle.FontTemplate.FontName, this.TemplateStyle.LegendTitle.FontTemplate.FontSize, this.TemplateStyle.LegendTitle.FontTemplate.FontStyle); _Theme.LegendColor = this.TemplateStyle.LegendTitle.FontTemplate.ForeColor; _Theme.LegendBodyFont = new Font(this.TemplateStyle.Legends.FontTemplate.FontName, this.TemplateStyle.Legends.FontTemplate.FontSize, this.TemplateStyle.Legends.FontTemplate.FontStyle); _Theme.LegendBodyColor = this.TemplateStyle.Legends.FontTemplate.ForeColor; } RetVal = _Theme; return RetVal; }
public static bool IsCategorical(this ChartSeriesType seriesType) { return(seriesType.IsCategoricalValue() || seriesType.IsCategoricalRange()); }
public InvalidChartAxisTypeException(ChartSeriesType seriesType, ChartAxisType axisType) : base(String.Format("Invalid axis type [{0}] for series type [{1}]", axisType, seriesType)) { SeriesType = seriesType; AxisType = axisType; }
public DnnChartSeries(string name, ChartSeriesType type, ChartSeriesCollection parent) : base(name, type, parent) { }
// Graphs protected void BindChart(RadChart chart, ChartSeriesType chartType, String chartTimeScale) { // Clear chart and reset total_usd double total_usd = 0; chart.Clear(); chart.PlotArea.XAxis.Items.Clear(); // Define parent chart series and format ChartSeries parent_series = new ChartSeries("parent_series", chartType); parent_series.Appearance.LegendDisplayMode = Telerik.Charting.ChartSeriesLegendDisplayMode.ItemLabels; parent_series.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange; chart.Series.Add(parent_series); // Iterate offices double highest_price = 0; double lowest_price = 999999; for (int i = 0; i < offices.Rows.Count; i++) { String territory = (String)offices.Rows[i]["Office"]; String shortname = (String)offices.Rows[i]["ShortName"]; Color colour = Util.ColourTryParse((String)offices.Rows[i]["Colour"]); // Toggle latest/annual data String timeScaleExpr = String.Empty; if (chartTimeScale == "latest") { timeScaleExpr = "=(SELECT SalesBookID FROM db_salesbookhead WHERE Office=@office ORDER BY StartDate DESC LIMIT 1) "; } else if (chartTimeScale == "annual") { timeScaleExpr = "IN (SELECT SalesBookID FROM db_salesbookhead WHERE Office=@office AND YEAR(StartDate)=@year) "; } // For each office.. String qry = "SELECT ROUND(IFNULL(CONVERT(SUM(Price*Conversion), SIGNED),0)- " + "IFNULL((SELECT CONVERT(SUM(rl_price*Conversion), SIGNED) " + "FROM db_salesbook sb, db_salesbookhead sbh " + "WHERE sb.rl_sb_id = sbh.SalesBookID " + "AND sbh.SalesBookID " + timeScaleExpr + "AND red_lined=1 AND IsDeleted=0 AND Office=@office),0)) as total_price " + "FROM db_salesbook sb, db_salesbookhead sbh " + "WHERE sb.sb_id = sbh.SalesBookID " + "AND sbh.SalesBookID " + timeScaleExpr + "AND deleted=0 AND IsDeleted=0"; String[] pn = { "@office", "@year" }; Object[] pv = { territory, dd_annual_year.Text }; DataTable totalprice = SQL.SelectDataTable(qry, pn, pv); if (totalprice.Rows.Count > 0 && totalprice.Rows[0]["total_price"] != DBNull.Value) { double price = Convert.ToDouble(totalprice.Rows[0]["total_price"]); String currency_terrtory = territory; total_usd += price; // Get max and min for chart padding highest_price = Math.Max(highest_price, price); lowest_price = Math.Min(lowest_price, price); ChartSeriesItem csi_item = new ChartSeriesItem( price, Util.TextToCurrency(price.ToString(), "usd"), colour, false); csi_item.Name = territory; csi_item.Parent = parent_series; parent_series.AddItem(csi_item); if (chart.ID.Contains("bar")) { chart.PlotArea.XAxis.Items.Add(new ChartAxisItem(shortname)); } else { csi_item.Appearance.FillStyle.MainColor = colour; csi_item.Appearance.FillStyle.SecondColor = colour; } } } // Individual chart formatting if (chart.ID.Contains("rc_pie")) { parent_series.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange; lbl_drill_down.Text = "Click a pie section to drill down"; chart.ChartTitle.Visible = false; chart.Height = 300; } else if (chart.ID.Contains("rc_bar")) { if (chart.ID.Contains("latest")) { parent_series.ActiveRegionToolTip = "Click to view the latest book for this territory."; } parent_series.Appearance.TextAppearance.TextProperties.Font = new Font("Verdana", 8, FontStyle.Regular); if (lowest_price != 0) { lowest_price = (lowest_price + (lowest_price / 100) * 40); } double step = highest_price / 10; if (step == 0) { step = 1; } rc_bar_latest.PlotArea.YAxis.AddRange(0, (highest_price + (highest_price / 100) * 20), step); } // Set total USD label lbl_total_usd.Text = "Total USD: " + Util.TextToCurrency(total_usd.ToString(), "us"); }
public DnnChartSeries(string seriesName, ChartSeriesType chartSeriesType, ChartSeriesCollection parent, ChartYAxisType yAxisType, StyleSeries style, string dataYColumn, string dataXColumn, string dataYColumn2, string dataXColumn2, string dataYColumn3, string dataYColumn4, string dataLabelsColumn) : base(seriesName, chartSeriesType, parent, yAxisType, style, dataYColumn, dataXColumn, dataYColumn2, dataXColumn2, dataYColumn3, dataYColumn4, dataLabelsColumn) { }
public static bool IsRadial(this ChartSeriesType seriesType) { return(RadialSeries.Contains(seriesType)); }