public PlotOptionsVM(PlotOptions options) { _options = options; Reset = CreateCommand(ResetExec); OK = CreateCommand(OkExec); ResetExec(); }
public Pie(int ID, string Titel, Serie serie) { this.ID = ID; this.Titel = Titel; Series = new List <Serie>(); if (serie.Data.Count != 0) { serie.Data[0].Selected = true; serie.Data[0].Sliced = true; } serie.ColorByPoint = true; Series.Add(serie); Chart = new Chart() { PlotShadow = false, Type = "pie" }; Tooltip = "{series.name}: <b>{point.percentage:.1f}%</b>"; PlotOptions = new PlotOptions() { AllowPointSelect = true, Cursor = "pointer", DataLabels = false, ShowInLegend = true }; }
internal PlotOptionsConfigurator(PlotOptions plotOptions) { this.plotOptions = plotOptions; this.Line = new LinePlotOptionsConfigurator(this.plotOptions.Line); this.Column = new ColumnPlotOptionsConfigurator(this.plotOptions.Column); this.Series = new SeriesPlotOptionsConfigurator(this.plotOptions.Series); }
private DotNet.Highcharts.Highcharts GetChart(Series[] series, DataEnum data) { Chart chart = null; XAxis xAxis = null; PlotOptions options = null; switch (data) { case DataEnum.random_points: xAxis = new XAxis { Categories = new[] { "50", "100", "500", "1k", "5k", "10k", "50k", "100k", "500k", "1M", "2M", "3M", "4M", "5M" } }; options = new PlotOptions(); chart = new Chart(); break; case DataEnum.countries: xAxis = new XAxis { Categories = series.Select(t => t.Name).ToArray() }; options = new PlotOptions { Column = new PlotOptionsColumn { Stacking = Stackings.Normal } }; chart = new Chart { DefaultSeriesType = ChartTypes.Column }; // ReSharper disable once PossibleNullReferenceException var results = new object[series.Length]; for (int i = 0; i < series.Length; i++) { results[i] = series.FirstOrDefault(x => x.Name.Equals(series[i].Name)).Data.ArrayData[0]; } series = new[] { new Series { Name = data.ToString(), Data = new Data(results) } }; break; } return(new DotNet.Highcharts.Highcharts("chart") .InitChart(chart) .SetTitle(new Title { Text = "Comparison result" }) .SetXAxis(xAxis) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Time (ms)" }, }) .SetSeries(series) .SetPlotOptions(options)); }
public Grafiek() { Chart = new Chart() { Type = "normal" }; xAs = new As(); yAs = new As(); Legende = new Legende(); PlotOptions = new PlotOptions(); Series = new List <Serie>(); isDefault = true; }
private static PlotOptions getPlotOptions(string color) { var plotOptions1 = new PlotOptions { LineStyle = PlotOptions.LineStyles.None, Marker = PlotOptions.Markers.Circle, MarkColor = color, Color = color, ThicknessSize = Helper.Length(1, Helper.MeasurementUnits.pt) }; return(plotOptions1); }
private static PlotOptions getBoxPlotOptions(float lowerWhisker, float lowerQuartile, float median, float upperQuartile, float upperWhisker, float drawPosition, string color) { var plotOptions1 = new PlotOptions { LineStyle = PlotOptions.LineStyles.Solid, Marker = PlotOptions.Markers.Circle, MarkColor = color, Color = color, BoxPlotPrepared = new BoxPlotPrepared(lowerWhisker, lowerQuartile, median, upperQuartile, upperWhisker, drawPosition), ThicknessSize = Helper.Length(1, Helper.MeasurementUnits.pt) }; return(plotOptions1); }
private static PlotOptions getPlotOptions(string color, bool shadedErrorBars, bool showInLegend) { var plotOptions1 = new PlotOptions { PlotType = PlotOptions.PlotTypes.LinearPlot, ShadedErrorBars = shadedErrorBars, LineStyle = PlotOptions.LineStyles.Solid, Marker = PlotOptions.Markers.None, MarkColor = color, Color = color, ShowInLegend = showInLegend, ThicknessSize = Helper.Length(1, Helper.MeasurementUnits.pt) }; return(plotOptions1); }
public ChartObject() { Chart = new Chart(); Accessibility = new Accessibility(); Title = new Title(); Subtitle = new Title(); XAxis = new XAxis(); YAxis = new YAxis(); Tooltip = new Tooltip(); PlotOptions = new PlotOptions(); Series = null; Credits = new Credits(); Legend = new Legend(); Responsive = new Responsive(); Exporting = new Exporting(); Pane = new Pane(); }
public Lijn(int ID, string Titel, As yAs, List <Serie> Series) { this.ID = ID; this.Titel = Titel; this.yAs = yAs; this.Series = Series; Legende = new Legende() { Layout = "vertical", Alignment = "right", VerticalAlign = "middle" }; PlotOptions = new PlotOptions() { SeriesLabelConnector = false }; }
/// <summary> /// The plotOptions is a wrapper object for config objects for each series type. The config objects for each series /// can also be overridden for each series item as given in the series array. /// Configuration options for the series are given in three levels. Options for all series in a chart are given in /// the plotOptions.series object. Then options for all series of a specific type are given in the plotOptions of /// that type, for example plotOptions.line. Next, options for one single series are given in the series array. /// </summary> /// <param name="plotOptions"></param> /// <returns></returns> public Highcharts SetPlotOptions(PlotOptions plotOptions) { _PlotOptions = plotOptions; return(this); }
private void PlotFigures(string chapterName, List <Coordinate> coordinates, Text chapterTitle = null) { if (chapterTitle == null) { chapterTitle = new Text(chapterName); } _objectsToReport.Add(new Chapter(chapterName, chapterTitle)); var colors = new List <Color>() { Color.Blue, Color.Red }; var axisOptions = new AxisOptions(NoConverter.Instance) { Title = "Test Title", XLabel = "X Axis", YLabel = "Y Axis", YMode = AxisOptions.AxisMode.log, LogTicksWithFixedPoint = true, XAxisPosition = AxisOptions.AxisXLine.bottom, YAxisPosition = AxisOptions.AxisYLine.left, LegendOptions = new LegendOptions { LegendPosition = LegendOptions.LegendPositions.NorthWest }, YMajorGrid = true }; var plotOptions1 = new PlotOptions { LineStyle = PlotOptions.LineStyles.Solid, Marker = PlotOptions.Markers.Triangle, Color = Color.Blue.Name, ErrorBars = true, ShadedErrorBars = true, Thickness = PlotOptions.Thicknesses.UltraThick }; var plot1 = new Plot(coordinates, plotOptions1) { LegendEntry = "legend entry 1" }; var plotItem = new TeXReporting.Items.Plot(colors, axisOptions, new List <Plot> { plot1 }, new Text("Test Figure")); var plotOptions2 = new PlotOptions { LineStyle = PlotOptions.LineStyles.DashDotted, Marker = PlotOptions.Markers.Circle, Color = Color.Red.Name, ErrorBars = true, ThicknessSize = Helper.Length(2, Helper.MeasurementUnits.pt), MarkSize = Helper.Length(3, Helper.MeasurementUnits.pt), MarkColor = Color.Blue.Name, MarkFillColor = String.Format("{0}!{1}", Color.Blue.Name, 20) }; var plot2 = new Plot(coordinates, plotOptions2) { LegendEntry = "0123456789 0123456789 0123456789 0123456789 0123456789 0123456789" }; var plotItem2 = new TeXReporting.Items.Plot(colors, axisOptions, new List <Plot> { plot2 }, new Text("Test Figure 2")); // Two Ordinates Plot var axisOptionsY1 = new AxisOptions(NoConverter.Instance) { EnlargeLimits = true, Title = "Test Title", XLabel = "X Axis", YLabel = "Y Axis", YMin = 0, XTickMin = 2F, XTickMax = 3F, MinorXTickNum = 1, MinorYTickNum = 1, BackgroundColor = "blue!10", YMode = AxisOptions.AxisMode.normal, XAxisPosition = AxisOptions.AxisXLine.bottom, YAxisPosition = AxisOptions.AxisYLine.left, YMajorGrid = true }; var axisOptionsY2 = new AxisOptions(DefaultConverter.Instance) { YLabel = "Y2 Axis", YAxisPosition = AxisOptions.AxisYLine.right, YAxisArrow = false, YScaledTicks = false, YMode = AxisOptions.AxisMode.log, LegendOptions = new LegendOptions { FontSize = LegendOptions.FontSizes.scriptsize, LegendAlignment = LegendOptions.LegendAlignments.left, LegendPosition = LegendOptions.LegendPositions.OuterNorthWest, RoundedCorners = true, Columns = 1, //TextWidth = Helper.GetWidthInPercentageOfTextWidth(30) }, XAxisPosition = AxisOptions.AxisXLine.none }; var plotTwoOrdinates = new PlotTwoOrdinates(colors, axisOptionsY1, new List <Plot> { plot1 }, axisOptionsY2, new List <Plot> { plot2 }, new Text("Test Two Ordinates")); var axisOptionsY3 = new AxisOptions(DefaultConverter.Instance) { YLabel = "Y3 Axis", YAxisPosition = AxisOptions.AxisYLine.right, YAxisArrow = false, YScaledTicks = true, YMin = 0, YDiscontinuity = AxisOptions.Discontinuities.parallel, YMode = AxisOptions.AxisMode.normal, LegendOptions = new LegendOptions { FontSize = LegendOptions.FontSizes.scriptsize, LegendAlignment = LegendOptions.LegendAlignments.left, LegendPosition = LegendOptions.LegendPositions.OuterNorthEast, RoundedCorners = true, Columns = 1, //TextWidth = Helper.GetWidthInPercentageOfTextWidth(30) }, XAxisPosition = AxisOptions.AxisXLine.none }; var plot3 = new Plot(new List <Coordinate> { new Coordinate(2.5F, 5F) }, new PlotOptions { Marker = PlotOptions.Markers.Triangle }) { LegendEntry = "Points" }; var plotThreeOrdinates = new PlotThreeOrdinates(colors, axisOptionsY1, new List <Plot> { plot1 }, axisOptionsY2, new List <Plot> { plot2 }, axisOptionsY3, new List <Plot> { plot3 }, new Text("Test Three Ordinates")); _objectsToReport.Add(new Section("Simple Figure 1")); var axisOptionsNormal = new AxisOptions(NoConverter.Instance) { Title = "Test Title", XLabel = "X Axis", YLabel = "Y Axis", YMode = AxisOptions.AxisMode.normal, LogTicksWithFixedPoint = true, XAxisPosition = AxisOptions.AxisXLine.bottom, YAxisPosition = AxisOptions.AxisYLine.left, LegendOptions = new LegendOptions { LegendPosition = LegendOptions.LegendPositions.NorthWest }, YMajorGrid = true }; var plotItemNormal = new TeXReporting.Items.Plot(plotItem.Colors, axisOptionsNormal, plotItem.Plots, new Text("Test Figure with normal scaled Y-Axis")); _objectsToReport.Add(plotItemNormal); _figureCounter++; _objectsToReport.Add(new Section("Simple Figure 2")); _objectsToReport.Add(plotItem); _figureCounter++; _objectsToReport.Add(new Section("Simple Figure 3")); _objectsToReport.Add(plotItem2); _figureCounter++; _objectsToReport.Add(new Section("Two Ordinates Figure")); _objectsToReport.Add(plotTwoOrdinates); _figureCounter++; _objectsToReport.Add(new Section("Three Ordinates Figure")); _objectsToReport.Add(plotThreeOrdinates); _figureCounter++; }
private List <Plot> getPlots(CurveChart chart, AxisTypes yAxisType) { var plots = new List <Plot>(); var xAxis = chart.Axes.First(x => x.AxisType == AxisTypes.X); var yAxis = chart.Axes.First(x => x.AxisType == yAxisType); var xUnit = xAxis.Dimension.Unit(xAxis.UnitName); var yUnit = yAxis.Dimension.Unit(yAxis.UnitName); foreach (var curve in chart.Curves) { if (!curve.Visible) { continue; } if (curve.yAxisType != yAxisType) { continue; } if (!isCurveCompatibleToYAxis(curve, yAxis)) { continue; } var coordinates = new List <Coordinate>(); var plotOptions = new PlotOptions(); DataColumn geometricErr = null; if (curve.yData.ContainsRelatedColumn(AuxiliaryType.GeometricStdDev)) { geometricErr = curve.yData.GetRelatedColumn(AuxiliaryType.GeometricStdDev); plotOptions.ErrorBars = true; plotOptions.ErrorType = PlotOptions.ErrorTypes.geometric; } DataColumn arithmeticErr = null; IDimension arithmeticErrDim = null; if (curve.yData.ContainsRelatedColumn(AuxiliaryType.ArithmeticStdDev)) { arithmeticErr = curve.yData.GetRelatedColumn(AuxiliaryType.ArithmeticStdDev); arithmeticErrDim = _dimensionFactory.MergedDimensionFor(arithmeticErr); plotOptions.ErrorBars = true; plotOptions.ErrorType = PlotOptions.ErrorTypes.arithmetic; } DataColumn geometricMeanPop = null; IDimension geometricMeanPopDim = null; if (curve.yData.ContainsRelatedColumn(AuxiliaryType.GeometricMeanPop)) { geometricMeanPop = curve.yData.GetRelatedColumn(AuxiliaryType.GeometricMeanPop); geometricMeanPopDim = _dimensionFactory.MergedDimensionFor(geometricMeanPop); plotOptions.ErrorBars = false; plotOptions.ErrorType = PlotOptions.ErrorTypes.geometric; plotOptions.ShadedErrorBars = true; plotOptions.Opacity = getOpacityFor(Constants.RANGE_AREA_OPACITY); } DataColumn arithmeticMeanPop = null; IDimension arithmeticMeanPopDim = null; if (curve.yData.ContainsRelatedColumn(AuxiliaryType.ArithmeticMeanPop)) { arithmeticMeanPop = curve.yData.GetRelatedColumn(AuxiliaryType.ArithmeticMeanPop); arithmeticMeanPopDim = _dimensionFactory.MergedDimensionFor(arithmeticMeanPop); plotOptions.ErrorBars = false; plotOptions.ErrorType = PlotOptions.ErrorTypes.arithmetic; plotOptions.ShadedErrorBars = true; plotOptions.Opacity = getOpacityFor(Constants.RANGE_AREA_OPACITY); } plotOptions.Color = curve.Color.Name; plotOptions.ThicknessSize = Helper.Length(convertLineThickness(curve.LineThickness), Helper.MeasurementUnits.pt); plotOptions.MarkSize = Helper.Length(convertLineThickness(curve.LineThickness), Helper.MeasurementUnits.pt); plotOptions.Marker = getMarker(curve.Symbol); plotOptions.LineStyle = getLineStyle(curve.LineStyle); IDimension xDimension = _dimensionFactory.MergedDimensionFor(curve.xData); IDimension yDimension = _dimensionFactory.MergedDimensionFor(curve.yData); for (var i = 0; i < curve.xData.Values.Count; i++) { var xValue = convertToUnit(xUnit, xDimension, curve.xData.Values[i]); var yValue = convertToUnit(yUnit, yDimension, curve.yData.Values[i]); var coordinate = new Coordinate(xValue, yValue); if (geometricMeanPop != null) { var yError = curve.yData.Values[i]; yValue = convertToUnit(yUnit, geometricMeanPopDim, geometricMeanPop.Values[i]); coordinate = new Coordinate(coordinate.X, yValue) { errY = yError }; } if (arithmeticMeanPop != null) { var yError = yValue; yValue = convertToUnit(yUnit, arithmeticMeanPopDim, arithmeticMeanPop.Values[i]); coordinate = new Coordinate(coordinate.X, yValue) { errY = yError }; } if (geometricErr != null) { coordinate.errY = geometricErr.Values[i]; } if (arithmeticErr != null) { coordinate.errY = convertToUnit(yUnit, arithmeticErrDim, arithmeticErr.Values[i]); } if (xAxis.NumberMode == NumberModes.Relative) { var max = curve.xData.Values.Max(); max = convertToUnit(xUnit, xDimension, max); coordinate = new Coordinate(coordinate.X / max * 100, coordinate.Y) { errY = coordinate.errY }; } if (yAxis.NumberMode == NumberModes.Relative) { var max = curve.yData.Values.Max(); if (geometricMeanPop != null) { max = geometricMeanPop.Values.Max(); max = convertToUnit(yUnit, geometricMeanPopDim, max); } if (arithmeticMeanPop != null) { max = arithmeticMeanPop.Values.Max(); max = convertToUnit(yUnit, arithmeticMeanPopDim, max); } coordinate = new Coordinate(coordinate.X, coordinate.Y / max * 100) { errY = coordinate.errY == null ? null : (arithmeticErr != null | arithmeticMeanPop != null) ? coordinate.errY / max * 100 : coordinate.errY }; } coordinates.Add(coordinate); } var plot = new Plot(coordinates, plotOptions) { LegendEntry = curve.Name }; // if all coordinates are nan, no plot can be created, so skip this plot if (!coordinates.All(c => float.IsNaN(c.X)) && !coordinates.All(c => float.IsNaN(c.Y))) { plots.Add(plot); } } return(plots); }
/// <summary> /// The plotOptions is a wrapper object for config objects for each series type. The config objects for each series /// can also be overridden for each series item as given in the series array. /// Configuration options for the series are given in three levels. Options for all series in a chart are given in /// the plotOptions.series object. Then options for all series of a specific type are given in the plotOptions of /// that type, for example plotOptions.line. Next, options for one single series are given in the series array. /// </summary> /// <param name="plotOptions"></param> /// <returns></returns> public HighStock SetPlotOptions(PlotOptions plotOptions) { this.plotOptions = plotOptions; return(this); }
public HighchartsRenderer Build() { var chartOptions = new Highcharts { Credits = new() { Enabled = false }, Chart = new() { BackgroundColor = "transparent" }, Title = new Title { Text = TitleText }, XAxis = new List <XAxis> { new XAxis { AllowDecimals = false, Categories = Labels, //Labels = new XAxisLabels { Step = 12@*, Rotation = -40*@ } } }, YAxis = new List <YAxis> { new YAxis { Title = new YAxisTitle { Text = YAxisTitleText }, } }, /* Tooltip = new Tooltip * { * PointFormat = "<b>{point.y:,.0f}</b> passangers" * },*/ PlotOptions = new PlotOptions { Area = new PlotOptionsArea { Marker = new PlotOptionsAreaMarker { Enabled = false, Symbol = "circle", Radius = 2, States = new PlotOptionsAreaMarkerStates { Hover = new PlotOptionsAreaMarkerStatesHover { Enabled = true } } } } }, Series = Data }; chartOptions.ID = Id; var renderer = new HighchartsRenderer(chartOptions); return(renderer); } }
/// <summary> /// The plotOptions is a wrapper object for config objects for each series type. The config objects for each series /// can also be overridden for each series item as given in the series array. /// Configuration options for the series are given in three levels. Options for all series in a chart are given in /// the plotOptions.series object. Then options for all series of a specific type are given in the plotOptions of /// that type, for example plotOptions.line. Next, options for one single series are given in the series array. /// </summary> /// <param name="plotOptions"></param> /// <returns></returns> public new Highstock SetPlotOptions(PlotOptions plotOptions) { base.SetPlotOptions(plotOptions); return(this); }
public override void Run() { if (wo.Value == null || wo.Value.ToString().Equals("")) { throw new Exception("WO Can not be null"); } OleExec sfcdb = DBPools["SFCDB"].Borrow(); //string workorderno = wo.Value.ToString(); //string ClosedFlag = CloseFlag.Value.ToString(); T_R_SN t = new T_R_SN(sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle); //DataTable dt = t.GetSNByWo(workorderno,sfcdb); //ReportTable retTab = new ReportTable(); //retTab.LoadData(dt, null); //retTab.Tittle = "ASSY Manufacture Report"; //Outputs.Add(retTab); #region 折綫圖 LineChart lChart = new LineChart(); lChart.GetSample1(); //lChart.Tittle = "SampleChart_折線圖"; //lChart.ChartTitle = "主标题"; //lChart.ChartSubTitle = "副标题"; //XAxis _XAxis = new XAxis(); //_XAxis.Title = "X轴标题"; //_XAxis.XAxisType = XAxisType.datetime; //lChart.XAxis = _XAxis; //lChart.Tooltip = "%"; //Yaxis _YAxis = new Yaxis(); //_YAxis.Title = "Y轴标题"; //lChart.YAxis = _YAxis; //ChartData lChartData = new ChartData(); //lChartData.name = "B32S1"; //lChartData.type = ChartType.line.ToString(); //PlotOptions PlotOptions = new PlotOptions(); //PlotOptions.type = PlotType.datetime; ////PlotOptions.pointStartDateTime = DateTime.Parse("2018-08-20 12:00:00"); ////PlotOptions.pointInterval = 3600000; //lChart.Plot = PlotOptions; //lChartData.data = new List<object> { new List<object>{ "2018-08-20 12:00:00" ,new string[] { "11","22","33"} }, //new List<object>{ "2018-08-20 13:00:00" ,new string[] { "111","222","333"} }} ; //List<ChartData> lChartDatas = new List<ChartData> { lChartData }; //lChart.ChartDatas = lChartDatas; Outputs.Add(lChart); #endregion #region 曲綫圖 LineChart spLineChart = new LineChart(); spLineChart.Tittle = "SampleChart_曲線圖"; spLineChart.ChartTitle = "主标题"; spLineChart.ChartSubTitle = "副标题"; XAxis _spXAxis = new XAxis(); _spXAxis.Title = "X轴标题"; _spXAxis.XAxisType = XAxisType.datetime; spLineChart.XAxis = _spXAxis; //spLineChart.Tooltip = "%"; Yaxis _spYAxis = new Yaxis(); _spYAxis.Title = "Y轴标题"; spLineChart.YAxis = _spYAxis; ChartData spChartData = new ChartData(); spChartData.name = "B32S1"; spChartData.type = ChartType.spline.ToString(); PlotOptions spPlotOptions = new PlotOptions(); spPlotOptions.type = PlotType.datetime; spLineChart.Plot = spPlotOptions; //日期會顯示在當鼠標經過圖標的時候 spChartData.data = new List <object> { new List <object> { "2018-05-29 10:00:00", 64 }, new List <object> { "2018-05-29 11:00:00", 78 }, new List <object> { "2018-05-29 12:00:00", 35 }, new List <object> { "2018-05-29 14:00:00", 235 }, new List <object> { "2018-05-29 15:00:00", 135 }, new List <object> { "2018-05-29 16:00:00", 85 }, new List <object> { "2018-05-29 17:00:00", 56 }, new List <object> { "2018-05-29 18:00:00", 15 }, new List <object> { "2018-05-29 19:00:00", 133 } }; List <ChartData> _spChartDatas = new List <ChartData> { spChartData }; spLineChart.ChartDatas = _spChartDatas; Outputs.Add(spLineChart); #endregion #region 面積圖 LineChart aLineChart = new LineChart(); aLineChart.Tittle = "SampleChart_面積圖"; aLineChart.ChartTitle = "主标题"; aLineChart.ChartSubTitle = "副标题"; XAxis _aXAxis = new XAxis(); _aXAxis.Title = "2018/08/20 降雨分佈"; //_aXAxis.XAxisType = XAxisType.BarChart; //_aXAxis.Categories = new string[] { "12","13","14","15","16","17","18" }; aLineChart.XAxis = _aXAxis; aLineChart.Tooltip = "%"; Yaxis _aYAxis = new Yaxis(); _aYAxis.Title = "降雨量"; aLineChart.YAxis = _aYAxis; ChartData aChartData = new ChartData(); aChartData.name = "降雨圖"; aChartData.type = ChartType.area.ToString(); PlotOptions aPlotOptions = new PlotOptions(); aPlotOptions.type = PlotType.intdata; aPlotOptions.pointStartIntdata = 8; //aPlotOptions.pointInterval = 2; aLineChart.Plot = aPlotOptions; aChartData.data = new List <object> { 198, 384, 64, 78, 35, 235, 135 }; List <ChartData> _aChartDatas = new List <ChartData> { aChartData }; aLineChart.ChartDatas = _aChartDatas; Outputs.Add(aLineChart); #endregion #region 餅狀圖 pieChart pChart = new pieChart(); pChart.Tittle = "餅狀圖測試 ZGJ"; pChart.ChartTitle = "餅狀圖主標題"; pChart.ChartSubTitle = "餅狀圖副標題"; ChartData pChartData = new ChartData(); pChartData.name = "餅狀圖數據"; pChartData.type = ChartType.pie.ToString(); pChartData.data = t.GetPieChartTestData(sfcdb); pChartData.colorByPoint = true; List <ChartData> pChartDatas = new List <ChartData> { pChartData }; pChart.ChartDatas = pChartDatas; Outputs.Add(pChart); #endregion #region 柱狀圖 columnChart cChart = new columnChart(); cChart.Tittle = "SampleChart_柱狀圖"; cChart.ChartTitle = "主标题"; cChart.ChartSubTitle = "副标题"; XAxis _cXAxis = new XAxis(); _cXAxis.Title = "X轴标题"; _cXAxis.XAxisType = XAxisType.BarChart; //不可以省略,表示X軸上面顯示的内容,如果沒有設定的話,就會變成 0,1,2,3,4 這些毫無意義的數據 _cXAxis.Categories = new string[] { "苹果", "橘子", "梨", "葡萄", "香蕉" }; cChart.XAxis = _cXAxis; cChart.Tooltip = "%"; Yaxis _cYAxis = new Yaxis(); _cYAxis.Title = "Y轴标题"; cChart.YAxis = _cYAxis; ChartData cChartData = new ChartData(); cChartData.name = "HWD 各線別產出"; cChartData.type = ChartType.column.ToString(); cChartData.colorByPoint = true; cChartData.data = new List <object> { new columnData() { name = "苹果", y = 10 }, new columnData() { name = "橘子", y = 2 }, new columnData() { name = "梨", y = -3 }, new columnData() { name = "葡萄", y = 4 }, new columnData() { name = "香蕉", y = 0.0 } }; List <ChartData> _cChartDatas = new List <ChartData> { cChartData }; cChart.ChartDatas = _cChartDatas; Outputs.Add(cChart); #endregion #region 指針式儀表圖 //EChartBase Chart1 = new EChartBase(); //Chart1.title = new { text = "測試指針式儀表數據" }; //for (int i = 0; i < 5; i++) //{ // GAUGE_Chart_Data GCD = new GAUGE_Chart_Data(); // GCD.min = 80; // GCD.max = 100; // GCD.splitNumber = 2; // GCD.endAngle = -45; // GCD.radius = "50%"; // GCD.name = "第" + i + "小時"; // GCD.axisLine = new // { // lineStyle = new // { // width = 8, // color = new List<Object>() // { new List<object>() { 0.5, "#FF0000" }, new List<object>() { 1, "#00FF00" }} // } // }; // int j = i + 1; // GCD.center = new List<string>() { $@"{j * 10 + 5}%", $@"50%" }; // GCD.data = new List<object> { new { value = 80 + i * 5, name = GCD.name } }; // Chart1.series.Add(GCD); //} //Chart1.Zone_ID = "TopZone"; //Outputs.Add(Chart1); #endregion if (sfcdb != null) { DBPools["SFCDB"].Return(sfcdb); } }
/// <summary> /// The plotOptions is a wrapper object for config objects for each series type. The config objects for each series /// can also be overridden for each series item as given in the series array. /// Configuration options for the series are given in three levels. Options for all series in a chart are given in /// the plotOptions.series object. Then options for all series of a specific type are given in the plotOptions of /// that type, for example plotOptions.line. Next, options for one single series are given in the series array. /// </summary> /// <param name="plotOptions"></param> /// <returns></returns> public Highstock SetPlotOptions(PlotOptions plotOptions) { _PlotOptions = plotOptions; return(this); }
public void AKR_PlotPdf() { CommandStart.Start(doc => { Editor ed = doc.Editor; CheckAcadVer2016(); PlotOptions plotOpt = new PlotOptions(); using (var lockDoc = doc.LockDocument()) { bool repeat = false; do { var optPrompt = new PromptKeywordOptions($"\nПечать листов в PDF из текущего чертежа, выбранных файлов или из всех чертежей в папке."); optPrompt.Keywords.Add("Текущего"); optPrompt.Keywords.Add("Папки"); optPrompt.Keywords.Add("Настройки"); optPrompt.Keywords.Default = "Папки"; var resPrompt = ed.GetKeywords(optPrompt); if (resPrompt.Status == PromptStatus.OK) { if (resPrompt.StringResult == "Текущего") { repeat = false; Logger.Log.Info("Текущего"); if (!File.Exists(doc.Name)) { throw new System.Exception("Нужно сохранить текущий чертеж."); } string filePdfName = Path.Combine(Path.GetDirectoryName(doc.Name), Path.GetFileNameWithoutExtension(doc.Name) + ".pdf"); PlotDirToPdf plotter = new PlotDirToPdf(new string[] { doc.Name }, filePdfName); plotter.Options = plotOpt; plotter.Plot(); } else if (resPrompt.StringResult == "Папки") { repeat = false; Logger.Log.Info("Папки"); var dialog = new AcadLib.UI.FileFolderDialog(); dialog.Dialog.Multiselect = true; dialog.IsFolderDialog = true; dialog.Dialog.Title = "Выбор папки или файлов для печати чертежей в PDF."; dialog.Dialog.Filter = "Чертежи|*.dwg"; if (_album == null) { dialog.Dialog.InitialDirectory = Path.GetDirectoryName(doc.Name); } else { dialog.Dialog.InitialDirectory = _album.AlbumDir == null ? Path.GetDirectoryName(doc.Name) : _album.AlbumDir; } if (dialog.ShowDialog() == DialogResult.OK) { PlotDirToPdf plotter; string firstFileNameWoExt = Path.GetFileNameWithoutExtension(dialog.Dialog.FileNames.First()); if (dialog.Dialog.FileNames.Count() > 1) { plotter = new PlotDirToPdf(dialog.Dialog.FileNames, Path.GetFileName(dialog.SelectedPath)); } else if (firstFileNameWoExt.Equals("п", StringComparison.OrdinalIgnoreCase)) { plotter = new PlotDirToPdf(dialog.SelectedPath); } else { plotter = new PlotDirToPdf(dialog.Dialog.FileNames, firstFileNameWoExt); } plotter.Options = plotOpt; plotter.Plot(); } } else if (resPrompt.StringResult == "Настройки") { // Сортировка; Все файлы в один пдф или для каждого файла отдельная пдф plotOpt.Show(); repeat = true; } } else { ed.WriteMessage("\nОтменено пользователем."); return; } } while (repeat); } }); }