private void initAxisProperties(ResultPage page, List <ResultCell[]> XDimensions) { bool hasNVD3Pie = Model.Elements.Exists(i => i.Nvd3Serie == NVD3SerieDefinition.PieChart && i.PivotPosition == PivotPosition.Data); var dimensions = XDimensions.FirstOrDefault(); if (dimensions != null) { //One value -> set the raw value, several values -> concat the display value if (dimensions.Length == 1) { if (!dimensions[0].Element.IsEnum && dimensions[0].Element.AxisUseValues && !hasNVD3Pie) { Model.ExecChartIsNumericAxis = dimensions[0].Element.IsNumeric; Model.ExecChartIsDateTimeAxis = dimensions[0].Element.IsDateTime; Model.ExecD3XAxisFormat = dimensions[0].Element.GetD3Format(CultureInfo, Model.ExecNVD3ChartType); Model.ExecMomentJSXAxisFormat = dimensions[0].Element.GetMomentJSFormat(); } } } }
public bool InitPageChart(ResultPage page) { if (Model != null) { try { if (Model.HasSerie && !page.ChartInitDone) { Model.CheckNVD3ChartIntegrity(); Model.CheckPlotlyChartIntegrity(); Model.CheckChartJSIntegrity(); buildChartSeries(page); } } catch (Exception ex) { _error = "Error got when generating chart:\r\n" + ex.Message; return(false); } } return(true); }
private void buildPages(ReportModel model) { model.Pages.Clear(); if (model.ResultTable == null) return; ResultCell[] currentPageValues = null; ResultPage currentPage = null; //Build pages foreach (DataRow row in model.ResultTable.Rows) { if (Report.Cancel) break; ResultCell[] pageValues = GetResultCells(PivotPosition.Page, row, model); ResultCell[] rowValues = GetResultCells(PivotPosition.Row, row, model); ResultCell[] columnValues = GetResultCells(PivotPosition.Column, row, model); ResultCell[] dataValues = GetResultCells(PivotPosition.Data, row, model); bool createPage = false; if (currentPageValues == null) { createPage = true; } else { createPage = IsDifferent(currentPageValues, pageValues); } currentPageValues = pageValues; if (createPage) { //Build new page currentPage = new ResultPage() { Report = Report }; //Create Page table currentPage.Pages = pageValues; model.Pages.Add(currentPage); } //Set values in page if (rowValues.Length > 0) { int rowIndex = 0; if (columnValues.Length == 0) { currentPage.Rows.Add(rowValues); rowIndex = currentPage.Rows.Count - 1; } else { //At least a column, we have to find the current row rowIndex = FindDimension(rowValues, currentPage.Rows); } rowValues = currentPage.Rows[rowIndex]; } int columnIndex = 0; if (columnValues.Length > 0) { columnIndex = FindDimension(columnValues, currentPage.Columns); columnValues = currentPage.Columns[columnIndex]; } if (dataValues.Length > 0) { ResultData data = new ResultData() { Row = rowValues, Column = columnValues, Data = dataValues }; if (!currentPage.Datas.ContainsKey(rowValues)) { currentPage.Datas.Add(rowValues, new List<ResultData>()); } currentPage.Datas[rowValues].Add(data); } } }
void handleCustomScripts(ReportModel model, ResultPage page, ResultTable table) { for (int row = 0; row < table.Lines.Count; row++) { var line = table.Lines[row]; for (int col = 0; col < line.Length; col++) { var cell = line[col]; if (cell.Element != null && !string.IsNullOrWhiteSpace(cell.Element.CellScript)) { cell.ContextRow = row; cell.ContextCol = col; cell.ContextTable = table; cell.ContextPage = page; cell.ContextModel = model; executeCellScript(cell); } } } }
public bool InitPageChart(ResultPage page) { if (Model != null) { try { checkChartIntegrity(page); if (Model.HasMicrosoftSerie) { Thread.CurrentThread.CurrentCulture = Report.ExecutionView.CultureInfo; //reload it from configuration _chartConfiguration = null; initMicrosoftChartConfigurationSeries(); page.Chart = ChartConfiguration; buildMicrosoftSeries(page); } else if (Model.HasNVD3Serie) { buildNVD3Series(page); } } catch (Exception ex) { _error = "Error got when generating chart:\r\n" + ex.Message; return false; } } return true; }
public bool GenerateMicrosoftChartImage(ResultPage page) { if (page.Chart != null) { CultureInfo initialCulture = Thread.CurrentThread.CurrentCulture; try { Thread.CurrentThread.CurrentCulture = Report.ExecutionView.CultureInfo; page.ChartPath = Report.GetChartFileName(); page.ChartFileName = Path.GetFileName(page.ChartPath); page.Chart.SaveImage(page.ChartPath, ChartImageFormat.Png); } catch (Exception ex) { _error = "Error got when generating chart:\r\n" + ex.Message; return false; } finally { Thread.CurrentThread.CurrentCulture = initialCulture; } } return true; }
private Dictionary<object, object> initXValues(ResultPage page, List<ResultCell[]> XDimensions) { Dictionary<object, object> result = new Dictionary<object, object>(); bool hasNVD3Pie = Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.PieChart && i.PivotPosition == PivotPosition.Data); foreach (var dimensions in XDimensions) { //One value -> set the raw value, several values -> concat the display value if (dimensions.Length == 1) { if (!dimensions[0].Element.IsEnum && dimensions[0].Element.AxisUseValues && !hasNVD3Pie) { result.Add(dimensions, dimensions[0].Value); } else { result.Add(dimensions, dimensions[0].ValueNoHTML); } } else result.Add(dimensions, Helper.ConcatCellValues(dimensions, ",")); } return result; }
private void initChartXValues(ResultPage page) { //Build list of X Values page.PrimaryXValues = initXValues(page, page.PrimaryXDimensions); page.SecondaryXValues = initXValues(page, page.SecondaryXDimensions); }
private void initAxisProperties(ResultPage page, List<ResultCell[]> XDimensions) { bool hasNVD3Pie = Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.PieChart && i.PivotPosition == PivotPosition.Data); var dimensions = XDimensions.FirstOrDefault(); if (dimensions != null) { //One value -> set the raw value, several values -> concat the display value if (dimensions.Length == 1) { if (!dimensions[0].Element.IsEnum && dimensions[0].Element.AxisUseValues && !hasNVD3Pie) { if (page.Chart != null) page.Chart.ChartAreas[0].AxisX.LabelStyle.Format = dimensions[0].Element.FormatEl; page.NVD3IsNumericAxis = dimensions[0].Element.IsNumeric; page.NVD3IsDateTimeAxis = dimensions[0].Element.IsDateTime; page.NVD3XAxisFormat = dimensions[0].Element.GetNVD3Format(CultureInfo, page.NVD3ChartType); } } } }
void checkChartIntegrity(ResultPage page) { if (Model.HasNVD3Serie && Model.HasMicrosoftSerie) throw new Exception("Invalid chart configuration: Cannot mix HTML5 and Microsoft Series."); if (Model.HasNVD3Serie) { bool hasArea = false, hasBar = false, hasLine = false; page.NVD3ChartType = ""; //Check and choose the right chart if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.ScatterChart)) { if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie != NVD3SerieDefinition.ScatterChart)) throw new Exception("Invalid chart configuration: Cannot mix NVD3 Point Serie with another type."); page.NVD3ChartType = "scatterChart"; } else if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.PieChart)) { if (Model.Elements.Count(i => i.SerieDefinition == SerieDefinition.NVD3Serie) > 1) throw new Exception("Invalid chart configuration: Only one Pie Serie can be defined."); page.NVD3ChartType = "pieChart"; } else if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.MultiBarHorizontalChart)) { if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie != NVD3SerieDefinition.MultiBarHorizontalChart)) throw new Exception("Invalid chart configuration: Cannot mix NVD3 Horizontal Bar Serie with another type."); page.NVD3ChartType = "multiBarHorizontalChart"; } else if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.LineWithFocusChart)) { if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie != NVD3SerieDefinition.LineWithFocusChart)) throw new Exception("Invalid chart configuration: Cannot mix NVD3 Line with focus Serie with another type."); page.NVD3ChartType = "lineWithFocusChart"; } else if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.DiscreteBarChart)) { if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie != NVD3SerieDefinition.DiscreteBarChart)) throw new Exception("Invalid chart configuration: Cannot mix NVD3 Discrete Bar Serie with another type."); page.NVD3ChartType = "discreteBarChart"; } else if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.CumulativeLineChart)) { if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie != NVD3SerieDefinition.CumulativeLineChart)) throw new Exception("Invalid chart configuration: Cannot mix NVD3 Cumulative Line Serie with another type."); page.NVD3ChartType = "cumulativeLineChart"; } else if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.StackedAreaChart)) { hasArea = true; if (!Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie != NVD3SerieDefinition.StackedAreaChart)) { //if primary and secondary axis are used, keep the multi chart if (!(Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.StackedAreaChart && i.YAxisType == AxisType.Primary) && Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.StackedAreaChart && i.YAxisType == AxisType.Secondary))) page.NVD3ChartType = "stackedAreaChart"; } } else if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.Line)) { hasLine = true; if (!Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie != NVD3SerieDefinition.Line)) { //if primary and secondary axis are used, keep the multi chart if (!(Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.Line && i.YAxisType == AxisType.Primary) && Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.Line && i.YAxisType == AxisType.Secondary))) page.NVD3ChartType = "lineChart"; } } else if (Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.MultiBarChart)) { hasBar = true; if (!Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie != NVD3SerieDefinition.MultiBarChart)) { //if primary and secondary axis are used, keep the multi chart if (!(Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.MultiBarChart && i.YAxisType == AxisType.Primary) && Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.MultiBarChart && i.YAxisType == AxisType.Secondary))) page.NVD3ChartType = "multiBarChart"; } } //If mix of Line, Bar and Area -> we go for multiChart if (string.IsNullOrEmpty(page.NVD3ChartType) && (hasArea || hasBar || hasLine)) page.NVD3ChartType = "multiChart"; } }
private void buildNVD3Series(ResultPage page) { initAxisProperties(page, page.PrimaryXDimensions); //Sort series if necessary, only one serie is used for sorting... if (!page.NVD3IsNumericAxis && !page.NVD3IsDateTimeAxis) { _serieForSort = page.Series.FirstOrDefault(i => i.Element.SerieSortType != SerieSortType.None); if (_serieForSort != null) { if (_serieForSort.Element.SerieSortType == SerieSortType.Y) page.PrimaryXDimensions.Sort(CompareXDimensionsWithSeries); else page.PrimaryXDimensions.Sort(CompareXDimensionsWithAxis); } } initChartXValues(page); page.NVD3XLabelMaxLen = 10; page.NVD3YPrimaryMaxLen = 6; page.NVD3YSecondaryMaxLen = 6; StringBuilder result = new StringBuilder(); if (!page.NVD3IsNumericAxis && !page.NVD3IsDateTimeAxis) { //Build X labels foreach (var key in page.PrimaryXValues.Keys) { if (result.Length != 0) result.Append(","); var xval = page.PrimaryXValues[key].ToString(); result.Append(Helper.QuoteSingle(HttpUtility.JavaScriptStringEncode(xval))); if (xval.Length > page.NVD3XLabelMaxLen) page.NVD3XLabelMaxLen = xval.Length; } page.NVD3XLabels = result.ToString(); } foreach (ResultSerie resultSerie in page.Series) { if (Report.Cancel) break; if (string.IsNullOrEmpty(page.NVD3PrimaryYAxisFormat) && resultSerie.Element.YAxisType == AxisType.Primary) { page.NVD3PrimaryYAxisFormat = resultSerie.Element.GetNVD3Format(CultureInfo, page.NVD3ChartType); page.NVD3PrimaryYIsDateTime = resultSerie.Element.IsDateTime; } else if (string.IsNullOrEmpty(page.NVD3SecondaryYAxisFormat) && resultSerie.Element.YAxisType == AxisType.Secondary) { page.NVD3SecondaryYAxisFormat = resultSerie.Element.GetNVD3Format(CultureInfo, page.NVD3ChartType); page.NVD3SecondaryYIsDateTime = resultSerie.Element.IsDateTime; } //Fill Serie result = new StringBuilder(); int index = 0; foreach (var xDimensionKey in page.PrimaryXValues.Keys) { string xValue = (index++).ToString(CultureInfo.InvariantCulture.NumberFormat); //Find the corresponding serie value... ResultSerieValue value = resultSerie.Values.FirstOrDefault(i => i.XDimensionValues == xDimensionKey); object yValue = (value != null ? value.Yvalue.Value : null); if (result.Length != 0) result.Append(","); if (resultSerie.Element.YAxisType == AxisType.Primary && value != null && value.Yvalue.DisplayValue.Length > page.NVD3YPrimaryMaxLen) page.NVD3YPrimaryMaxLen = value.Yvalue.DisplayValue.Length; if (resultSerie.Element.YAxisType == AxisType.Secondary && value != null && value.Yvalue.DisplayValue.Length > page.NVD3YSecondaryMaxLen) page.NVD3YSecondaryMaxLen = value.Yvalue.DisplayValue.Length; if (page.NVD3IsNumericAxis) { Double db = 0; if (value == null) Double.TryParse(page.PrimaryXValues[xDimensionKey].ToString(), out db); else if (value.XDimensionValues[0].DoubleValue != null) db = value.XDimensionValues[0].DoubleValue.Value; xValue = db.ToString(CultureInfo.InvariantCulture.NumberFormat); } else if (page.NVD3IsDateTimeAxis) { DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0, 0); if (value == null) dt = ((DateTime)page.PrimaryXValues[xDimensionKey]); else if (value.XDimensionValues[0].DateTimeValue != null) dt = value.XDimensionValues[0].DateTimeValue.Value; TimeSpan diff = dt.ToUniversalTime() - (new DateTime(1970, 1, 1, 0, 0, 0, 0)); xValue = string.Format("{0}000", Math.Floor(diff.TotalSeconds)); } if (yValue is DateTime) { TimeSpan diff = ((DateTime)yValue).ToUniversalTime() - (new DateTime(1970, 1, 1, 0, 0, 0, 0)); yValue = string.Format("{0}000", Math.Floor(diff.TotalSeconds)); } else if (yValue is Double) { yValue = ((Double)yValue).ToString(CultureInfo.InvariantCulture.NumberFormat); } result.AppendFormat("{{x:{0},y:{1}}}", xValue, yValue == null ? "0" : yValue); } resultSerie.NVD3SerieValues = result.ToString(); } }
private void buildMicrosoftSeries(ResultPage page) { initAxisProperties(page, page.PrimaryXDimensions); initAxisProperties(page, page.SecondaryXDimensions); initChartXValues(page); foreach (ResultSerie resultSerie in page.Series) { if (Report.Cancel) break; Series serieConfiguration = ChartConfiguration.Series.FirstOrDefault(i => i.Name.Contains(resultSerie.Element.GUID)); if (serieConfiguration != null) { Series serie = Helper.CloneSeries(serieConfiguration); serie.Tag = 1; serie.Name = resultSerie.SerieDisplayName; page.Chart.Series.Add(serie); //Fill Serie Dictionary<object, object> XValues = (resultSerie.Element.XAxisType == AxisType.Primary ? page.PrimaryXValues : page.SecondaryXValues); foreach (var xDimensionKey in XValues.Keys) { //Find the corresponding serie value... ResultSerieValue value = resultSerie.Values.FirstOrDefault(i => i.XDimensionValues == xDimensionKey); object yValue = (value != null ? value.Yvalue.Value : null); serie.Points.AddXY(XValues[xDimensionKey], yValue); } //Sort serie if (resultSerie.Element.SerieSortType != SerieSortType.None) serie.Sort(resultSerie.Element.SerieSortOrder, resultSerie.Element.SerieSortType.ToString()); } } //clear the series used for configurations int index = page.Chart.Series.Count; while (--index >= 0) if (page.Chart.Series[index].Tag == null) page.Chart.Series.RemoveAt(index); }
private Dictionary<object, object> initXValues(ResultPage page, List<ResultCell[]> XDimensions) { Dictionary<object, object> result = new Dictionary<object, object>(); bool hasNVD3Pie = Model.Elements.Exists(i => i.SerieDefinition == SerieDefinition.NVD3Serie && i.Nvd3Serie == NVD3SerieDefinition.PieChart && i.PivotPosition == PivotPosition.Data); bool orderAsc = true; foreach (var dimensions in XDimensions) { //One value -> set the raw value, several values -> concat the display value if (dimensions.Length == 1) { if (!dimensions[0].Element.IsEnum && dimensions[0].Element.AxisUseValues && !hasNVD3Pie) { result.Add(dimensions, dimensions[0].Value); } else { result.Add(dimensions, dimensions[0].ValueNoHTML); } } else result.Add(dimensions, Helper.ConcatCellValues(dimensions, ",")); if (dimensions.Length > 0 && dimensions[0].Element.SortOrder.Contains(SortOrderConverter.kAutomaticDescSortKeyword)) orderAsc = false; } return orderAsc ? result.OrderBy(i => i.Value).ToDictionary(i => i.Key, i => i.Value) : result.OrderByDescending(i => i.Value).ToDictionary(i => i.Key, i => i.Value); }
private void buildChartSeries(ResultPage page) { if (page.ChartInitDone) { return; } initAxisProperties(page, page.PrimaryXDimensions); //Sort series if necessary, only one serie is used for sorting... if (!Model.ExecChartIsNumericAxis && !Model.ExecChartIsDateTimeAxis) { _serieForSort = page.Series.FirstOrDefault(i => i.Element.SerieSortType != SerieSortType.None); if (_serieForSort != null) { if (_serieForSort.Element.SerieSortType == SerieSortType.Y) { page.PrimaryXDimensions.Sort(CompareXDimensionsWithSeries); } else { page.PrimaryXDimensions.Sort(CompareXDimensionsWithAxis); } } } initChartXValues(page); page.AxisXLabelMaxLen = 10; page.AxisYPrimaryMaxLen = 6; page.AxisYSecondaryMaxLen = 6; StringBuilder result = new StringBuilder(), navs = new StringBuilder(); // TOCHECK ? if (!Model.ExecChartIsNumericAxis && !Model.ExecChartIsDateTimeAxis) // { //Build X labels foreach (var key in page.PrimaryXValues.Keys) { ResultCell[] dimensions = key as ResultCell[]; if (result.Length != 0) { result.Append(","); } var xval = (dimensions.Length == 1 ? dimensions[0].DisplayValue : page.PrimaryXValues[key].ToString()); result.Append(Helper.QuoteSingle(HttpUtility.JavaScriptStringEncode(xval))); if (xval.Length > page.AxisXLabelMaxLen) { page.AxisXLabelMaxLen = xval.Length; } var navigation = Model.GetNavigation(((ResultCell[])key)[0]); if (!string.IsNullOrEmpty(navigation)) { if (navs.Length != 0) { navs.Append(","); } navs.Append(navigation); } } page.ChartXLabels = result.ToString(); page.ChartNavigations = navs.ToString(); // } foreach (ResultSerie resultSerie in page.Series) { if (Report.Cancel) { break; } if (string.IsNullOrEmpty(Model.ExecD3PrimaryYAxisFormat) && resultSerie.Element.YAxisType == AxisType.Primary) { Model.ExecD3PrimaryYAxisFormat = resultSerie.Element.GetD3Format(CultureInfo, Model.ExecNVD3ChartType); Model.ExecAxisPrimaryYIsDateTime = resultSerie.Element.IsDateTime; } else if (string.IsNullOrEmpty(Model.ExecD3SecondaryYAxisFormat) && resultSerie.Element.YAxisType == AxisType.Secondary) { Model.ExecD3SecondaryYAxisFormat = resultSerie.Element.GetD3Format(CultureInfo, Model.ExecNVD3ChartType); Model.ExecAxisSecondaryYIsDateTime = resultSerie.Element.IsDateTime; } //Fill Serie StringBuilder chartXResult = new StringBuilder(), chartXDateTimeResult = new StringBuilder(), chartYResult = new StringBuilder(); StringBuilder chartXYResult = new StringBuilder(), chartYDisplayResult = new StringBuilder(); int index = 0; foreach (var xDimensionKey in page.PrimaryXValues.Keys) { string xValue = (index++).ToString(CultureInfo.InvariantCulture.NumberFormat); DateTime xValueDT = DateTime.MinValue; //Find the corresponding serie value... ResultSerieValue value = resultSerie.Values.FirstOrDefault(i => i.XDimensionValues == xDimensionKey); object yValue = (value != null ? value.Yvalue.Value : null); if (resultSerie.Element.YAxisType == AxisType.Primary && value != null && value.Yvalue.DisplayValue.Length > page.AxisYPrimaryMaxLen) { page.AxisYPrimaryMaxLen = value.Yvalue.DisplayValue.Length; } if (resultSerie.Element.YAxisType == AxisType.Secondary && value != null && value.Yvalue.DisplayValue.Length > page.AxisYSecondaryMaxLen) { page.AxisYSecondaryMaxLen = value.Yvalue.DisplayValue.Length; } if (Model.ExecChartIsNumericAxis) { Double db = 0; if (value == null) { Double.TryParse(page.PrimaryXValues[xDimensionKey].ToString(), out db); } else if (value.XDimensionValues[0].DoubleValue != null) { db = value.XDimensionValues[0].DoubleValue.Value; } xValue = db.ToString(CultureInfo.InvariantCulture.NumberFormat); } else if (Model.ExecChartIsDateTimeAxis) { DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0, 0); if (value == null) { dt = ((DateTime)page.PrimaryXValues[xDimensionKey]); } else if (value.XDimensionValues[0].DateTimeValue != null) { dt = value.XDimensionValues[0].DateTimeValue.Value; } xValueDT = dt; TimeSpan diff = dt.ToUniversalTime() - (new DateTime(1970, 1, 1, 0, 0, 0, 0)); xValue = string.Format("{0}000", Math.Floor(diff.TotalSeconds)); } if (yValue is DateTime) { TimeSpan diff = ((DateTime)yValue).ToUniversalTime() - (new DateTime(1970, 1, 1, 0, 0, 0, 0)); yValue = string.Format("{0}000", Math.Floor(diff.TotalSeconds)); } else if (yValue is Double) { yValue = ((Double)yValue).ToString(CultureInfo.InvariantCulture.NumberFormat); } if (yValue == null && GetBoolValue(Parameter.NVD3AddNullPointParameter)) { yValue = "0"; } if (yValue != null) { if (chartXYResult.Length != 0) { chartXYResult.Append(","); } chartXYResult.AppendFormat("{{x:{0},y:{1}}}", xValue, yValue); if (chartXResult.Length != 0) { chartXResult.Append(","); } chartXResult.AppendFormat("{0}", xValue); if (Model.ExecChartIsDateTimeAxis) { if (chartXDateTimeResult.Length != 0) { chartXDateTimeResult.Append(","); } chartXDateTimeResult.AppendFormat("\"{0:yyyy-MM-dd HH:mm:ss}\"", xValueDT); } if (chartYResult.Length != 0) { chartYResult.Append(","); } chartYResult.AppendFormat("{0}", yValue); //? if (chartYDisplayResult.Length != 0) chartYDisplayResult.Append(","); //? chartYDisplayResult.AppendFormat("'{0}'", Helper.ToJS(value.Yvalue.DisplayValue)); } } resultSerie.ChartXYSerieValues = chartXYResult.ToString(); resultSerie.ChartXSerieValues = chartXResult.ToString(); resultSerie.ChartXDateTimeSerieValues = chartXDateTimeResult.ToString(); resultSerie.ChartYSerieValues = chartYResult.ToString(); //?resultSerie.ChartYSerieDisplayValues = chartYDisplayResult.ToString(); } page.ChartInitDone = true; }