コード例 #1
0
        public override ShapeEx Create(OpenXmlElement sdkElement)
        {
            Check.NotNull(sdkElement, nameof(sdkElement));

            if (sdkElement is P.GraphicFrame sdkGraphicFrame)
            {
                var grData = sdkElement.GetFirstChild <A.Graphic>().GetFirstChild <A.GraphicData>();
                if (grData.Uri.Value.Equals(Uri, StringComparison.Ordinal))
                {
                    var spContext      = _shapeContextBuilder.Build(sdkElement);
                    var innerTransform = _transformFactory.FromComposite(sdkGraphicFrame);
                    var chartEx        = new ChartEx(sdkGraphicFrame, spContext);
                    var shape          = _shapeBuilder.WithChart(innerTransform, spContext, chartEx);

                    return(shape);
                }
            }

            if (Successor != null)
            {
                return(Successor.Create(sdkElement));
            }

            return(null);
        }
コード例 #2
0
        public override ShapeEx Create(OpenXmlElement openXmlElement)
        {
            Check.NotNull(openXmlElement, nameof(openXmlElement));

            if (openXmlElement is P.GraphicFrame sdkGraphicFrame)
            {
                var grData = openXmlElement.GetFirstChild <A.Graphic>().GetFirstChild <A.GraphicData>();
                if (grData.Uri.Value.Equals(Uri))
                {
                    var spContext      = new ShapeContext(_preSettings, _sldFontService, sdkGraphicFrame, _sdkSldPart);
                    var innerTransform = _transformFactory.FromComposite(sdkGraphicFrame);
                    var chartEx        = new ChartEx(sdkGraphicFrame, spContext);
                    var shape          = _shapeBuilder.WithChart(innerTransform, spContext, chartEx);

                    return(shape);
                }
            }

            if (Successor != null)
            {
                return(Successor.Create(openXmlElement));
            }

            return(null);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            //Create empty presentation
            using (PresentationEx pres = new PresentationEx())
            {
                //Accessing first slide
                SlideEx slide = pres.Slides[0];

                //Addding default chart
                ChartEx ppChart = slide.Shapes.AddChart(ChartTypeEx.ClusteredColumn3D, 20F, 30F, 400F, 300F);

                //Getting Chart data
                ChartDataEx chartData = ppChart.ChartData;

                //Removing Extra default series
                chartData.Series.RemoveAt(1);
                chartData.Series.RemoveAt(1);

                //Modifying chart categories names
                chartData.Categories[0].ChartDataCell.Value = "Bikes";
                chartData.Categories[1].ChartDataCell.Value = "Accessories";
                chartData.Categories[2].ChartDataCell.Value = "Repairs";
                chartData.Categories[3].ChartDataCell.Value = "Clothing";

                //Modifying chart series values for first category
                chartData.Series[0].Values[0].Value = 1000;
                chartData.Series[0].Values[1].Value = 2500;
                chartData.Series[0].Values[2].Value = 4000;
                chartData.Series[0].Values[3].Value = 3000;

                //Setting Chart title
                ppChart.HasTitle             = true;
                ppChart.ChartTitle.Text.Text = "2007 Sales";
                PortionFormatEx format = ppChart.ChartTitle.Text.Paragraphs[0].Portions[0].PortionFormat;
                format.FontItalic                      = NullableBool.True;
                format.FontHeight                      = 18;
                format.FillFormat.FillType             = FillTypeEx.Solid;
                format.FillFormat.SolidFillColor.Color = Color.Black;


                //Setting Axis values
                ppChart.ValueAxis.IsAutomaticMaxValue  = false;
                ppChart.ValueAxis.IsAutomaticMinValue  = false;
                ppChart.ValueAxis.IsAutomaticMajorUnit = false;
                ppChart.ValueAxis.IsAutomaticMinorUnit = false;

                ppChart.ValueAxis.MaxValue          = 4000.0F;
                ppChart.ValueAxis.MinValue          = 0.0F;
                ppChart.ValueAxis.MajorUnit         = 2000.0F;
                ppChart.ValueAxis.MinorUnit         = 1000.0F;
                ppChart.ValueAxis.TickLabelPosition = TickLabelPositionType.NextTo;

                //Setting Chart rotation
                ppChart.Rotation3D.RotationX = 15;
                ppChart.Rotation3D.RotationY = 20;

                //Saving Presentation
                pres.Write("AsposeSampleChart.pptx");
            }
        }
コード例 #4
0
 public Form1()
 {
     InitializeComponent();
     chartEx       = new ChartEx(chart1);
     rbRaw.Checked = true;
     CreateEnabledSeries();
     Generate();
     UpdateCheckList();
     nudPoints.Value       = pointsAmount;
     nudInterval.Value     = timer1.Interval;
     nudValuesRange.Value  = pointsRange;
     nudMaxPoints.Value    = chartEx.MaxRenderedPoints;
     nudSeries.Value       = seriesAmount;
     nudDelta.Value        = (decimal)delta;
     cbApproximate.Checked = chartEx.ApproximationEnabled;
     cbDash.Checked        = chartEx.UseDashLines;
     //   timer1.Start();
     bTimer.Text      = (timer1.Enabled ? "Stop" : "Start");
     bTimer.BackColor = (timer1.Enabled ? Color.IndianRed : Color.LimeGreen);
 }
コード例 #5
0
 private static void OnDataSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     ChartEx source = d as ChartEx;
     if (source.DataSourceChanged != null)
         source.DataSourceChanged(source, new EventArgs());
 }