/// <summary>
        /// Writes the plot.
        /// </summary>
        /// <param name="plot">
        /// The plot.
        /// </param>
        public void WritePlot(PlotFigure plot)
        {
            this.WriteStartFigure();
            switch (this.PlotElementType)
            {
            case HtmlPlotElementType.Embed:
            case HtmlPlotElementType.Object:
                // TODO: need a Func<string,Stream> to provide streams for the plot files?

                //string source = string.Format(
                //    "{0}_Plot{1}.svg", Path.GetFileNameWithoutExtension(this.outputFile), plot.FigureNumber);
                //plot.PlotModel.SaveSvg(this.GetFullFileName(source), plot.Width, plot.Height, this.textMeasurer);
                //this.WriteStartElement(this.PlotElementType == HtmlPlotElementType.Embed ? "embed" : "object");
                //this.WriteAttributeString("src", source);
                //this.WriteAttributeString("type", "image/svg+xml");
                //this.WriteEndElement();
                break;

            case HtmlPlotElementType.Svg:
                this.WriteRaw(plot.PlotModel.ToSvg(plot.Width, plot.Height, false, this.textMeasurer));
                break;
            }

            this.WriteEndFigure(plot.FigureText);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Writes the plot.
        /// </summary>
        /// <param name="plot">
        /// The plot.
        /// </param>
        public void WritePlot(PlotFigure plot)
        {
            this.WriteStartFigure();
            switch (this.PlotElementType)
            {
            case HtmlPlotElementType.Embed:
            case HtmlPlotElementType.Object:
#if PCL
                // Writing to file not supported
#else
                string source = string.Format(
                    "{0}_Plot{1}.svg", Path.GetFileNameWithoutExtension(this.outputFile), plot.FigureNumber);
                plot.PlotModel.SaveSvg(this.GetFullFileName(source), plot.Width, plot.Height, this.textMeasurer);
                this.WriteStartElement(this.PlotElementType == HtmlPlotElementType.Embed ? "embed" : "object");
                this.WriteAttributeString("src", source);
                this.WriteAttributeString("type", "image/svg+xml");
                this.WriteEndElement();
#endif
                break;

            case HtmlPlotElementType.Svg:
                this.WriteRaw(plot.PlotModel.ToSvg(plot.Width, plot.Height, false, this.textMeasurer));
                break;
            }

            this.WriteEndFigure(plot.FigureText);
        }
        /// <summary>
        /// Writes the plot.
        /// </summary>
        /// <param name="plot">
        /// The plot.
        /// </param>
        public void WritePlot(PlotFigure plot)
        {
            this.WriteStartFigure();
            switch (this.PlotElementType)
            {
                case HtmlPlotElementType.Embed:
                case HtmlPlotElementType.Object:
                    // TODO: need a Func<string,Stream> to provide streams for the plot files?

                    //string source = string.Format(
                    //    "{0}_Plot{1}.svg", Path.GetFileNameWithoutExtension(this.outputFile), plot.FigureNumber);
                    //plot.PlotModel.SaveSvg(this.GetFullFileName(source), plot.Width, plot.Height, this.textMeasurer);
                    //this.WriteStartElement(this.PlotElementType == HtmlPlotElementType.Embed ? "embed" : "object");
                    //this.WriteAttributeString("src", source);
                    //this.WriteAttributeString("type", "image/svg+xml");
                    //this.WriteEndElement();
                    break;
                case HtmlPlotElementType.Svg:
                    this.WriteRaw(plot.PlotModel.ToSvg(plot.Width, plot.Height, false, this.textMeasurer));
                    break;
            }

            this.WriteEndFigure(plot.FigureText);
        }
Exemplo n.º 4
0
 /// <summary>
 /// The write plot.
 /// </summary>
 /// <param name="plot">The plot.</param>
 public void WritePlot(PlotFigure plot)
 {
 }
        /// <summary>
        /// The write plot.
        /// </summary>
        /// <param name="plot">
        /// The plot.
        /// </param>
        public void WritePlot(PlotFigure plot)
        {
            if (this.FileName == null)
            {
                return;
            }

            var directory = Path.GetDirectoryName(this.FileName);
            if (directory == null)
            {
                return;
            }

            var source = string.Format(
                "{0}_Plot{1}.png", Path.GetFileNameWithoutExtension(this.FileName), plot.FigureNumber);
            var sourceFullPath = Path.Combine(directory, source);

            // write to a png
            // todo: write to a stream, not to disk
            PngExporter.Export(plot.PlotModel, sourceFullPath, (int)plot.Width, (int)plot.Height);

            // append the image to the document
            this.AppendImage(sourceFullPath, "Plot" + plot.FigureNumber);

            this.body.Append(CreateParagraph(plot.GetFullCaption(this.style), FigureTextID));
        }
 /// <summary>
 /// The write plot.
 /// </summary>
 /// <param name="plot">
 /// The plot.
 /// </param>
 public void WritePlot(PlotFigure plot)
 {
 }
 /// <summary>
 /// Writes the plot.
 /// </summary>
 /// <param name="plot">
 /// The plot.
 /// </param>
 public void WritePlot(PlotFigure plot)
 {
     // string path = "plot" + plotNumber + ".pdf";
     // PdfExporter.Export(Model, pdfPlotFileName, 800, 500);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Writes the specified plot.
        /// </summary>
        /// <param name="plot">The plot.</param>
        void IReportWriter.WritePlot(PlotFigure plot)
        {
            var temporaryPlotFileName = Guid.NewGuid() + ".pdf";
            this.temporaryPlotFiles.Add(temporaryPlotFileName);
            PdfExporter.Export(plot.PlotModel, temporaryPlotFileName, plot.Width, plot.Height);

            var p = this.WriteStartFigure(plot);
            MigraDoc.DocumentObjectModel.Shapes.Image pi = p.AddImage(temporaryPlotFileName);
            pi.Width = Unit.FromCentimeter(15);

            this.WriteEndFigure(plot, p);
        }
Exemplo n.º 9
0
        /// <summary>
        /// The write plot.
        /// </summary>
        /// <param name="plot">
        /// The plot.
        /// </param>
        public void WritePlot(PlotFigure plot)
        {
            if (this.FileName == null)
            {
                return;
            }

            var directory = Path.GetDirectoryName(this.FileName);
            if (directory == null)
            {
                return;
            }

            var source = string.Format(
                "{0}_Plot{1}.pdf", Path.GetFileNameWithoutExtension(this.FileName), plot.FigureNumber);
            var sourceFullPath = Path.Combine(directory, source);

            PdfExporter.Export(plot.PlotModel, sourceFullPath, plot.Width, plot.Height);

            var p = this.WriteStartFigure(plot);
            MigraDoc.DocumentObjectModel.Shapes.Image pi = p.AddImage(sourceFullPath);
            pi.Width = Unit.FromCentimeter(15);

            this.WriteEndFigure(plot, p);
        }
        /// <summary>
        /// Writes the plot.
        /// </summary>
        /// <param name="plot">
        /// The plot.
        /// </param>
        public void WritePlot(PlotFigure plot)
        {
            this.WriteStartFigure();
            switch (this.PlotElementType)
            {
                case HtmlPlotElementType.Embed:
                case HtmlPlotElementType.Object:
#if PCL
                    // Writing to file not supported
#else
                    string source = string.Format(
                        "{0}_Plot{1}.svg", Path.GetFileNameWithoutExtension(this.outputFile), plot.FigureNumber);
                    plot.PlotModel.SaveSvg(this.GetFullFileName(source), plot.Width, plot.Height, this.textMeasurer);
                    this.WriteStartElement(this.PlotElementType == HtmlPlotElementType.Embed ? "embed" : "object");
                    this.WriteAttributeString("src", source);
                    this.WriteAttributeString("type", "image/svg+xml");
                    this.WriteEndElement();
#endif
                    break;
                case HtmlPlotElementType.Svg:
                    this.WriteRaw(plot.PlotModel.ToSvg(plot.Width, plot.Height, false, this.textMeasurer));
                    break;
            }

            this.WriteEndFigure(plot.FigureText);
        }