Exemplo n.º 1
0
    public static void DefineCharts(Document document)
    {
      Paragraph paragraph = document.LastSection.AddParagraph("Chart Overview", "Heading1");
      paragraph.AddBookmark("Charts");

      document.LastSection.AddParagraph("Sample Chart", "Heading2");

      Chart chart = new Chart();
      chart.Left = 0;

      chart.Width = Unit.FromCentimeter(16);
      chart.Height = Unit.FromCentimeter(12);
      Series series = chart.SeriesCollection.AddSeries();
      series.ChartType = ChartType.Column2D;
      series.Add(new double[]{1, 17, 45, 5, 3, 20, 11, 23, 8, 19});
      series.HasDataLabel = true;

      series = chart.SeriesCollection.AddSeries();
      series.ChartType = ChartType.Line;
      series.Add(new double[]{41, 7, 5, 45, 13, 10, 21, 13, 18, 9});

      XSeries xseries = chart.XValues.AddXSeries();
      xseries.Add("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N");

      chart.XAxis.MajorTickMark = TickMarkType.Outside;
      chart.XAxis.Title.Caption = "X-Axis";
      
      chart.YAxis.MajorTickMark = TickMarkType.Outside;
      chart.YAxis.HasMajorGridlines = true;

      chart.PlotArea.LineFormat.Color = Colors.DarkGray;
      chart.PlotArea.LineFormat.Width = 1;

      document.LastSection.Add(chart);
    }
Exemplo n.º 2
0
 internal ChartRenderer(DocumentObject domObj, RtfDocumentRenderer docRenderer)
     : base(domObj, docRenderer)
 {
     this.chart = (Chart)domObj;
       this.isInline = DocumentRelations.HasParentOfType(this.chart, typeof(Paragraph)) ||
     RenderInParagraph();
 }
Exemplo n.º 3
0
        internal override void VisitChart(Chart chart)
        {
            Document document = chart.Document;
              if (chart.style.IsNull)
            chart.style.Value = Style.DefaultParagraphName;
              Style style = document.Styles[chart.style.Value];
              if (chart.format == null)
              {
            chart.format = style.paragraphFormat.Clone();
            chart.format.parent = chart;
              }
              else
            FlattenParagraphFormat(chart.format, style.paragraphFormat);

              FlattenLineFormat(chart.lineFormat, null);
              FlattenFillFormat(chart.fillFormat);

              FlattenAxis(chart.xAxis);
              FlattenAxis(chart.yAxis);
              FlattenAxis(chart.zAxis);

              FlattenPlotArea(chart.plotArea);

              //      if (this.hasDataLabel.Value)
              FlattenDataLabel(chart.dataLabel);
        }
Exemplo n.º 4
0
 internal ChartRenderer(XGraphics gfx, Chart chart, FieldInfos fieldInfos)
     : base(gfx, chart, fieldInfos)
 {
     _chart = chart;
     ChartRenderInfo renderInfo = new ChartRenderInfo();
     renderInfo.DocumentObject = _shape;
     _renderInfo = renderInfo;
 }
Exemplo n.º 5
0
 internal ChartRenderer(XGraphics gfx, Chart chart, FieldInfos fieldInfos)
   : base(gfx, chart, fieldInfos)
 {
   this.chart = chart;
   ChartRenderInfo renderInfo = new ChartRenderInfo();
   renderInfo.shape = this.shape;
   this.renderInfo = renderInfo;
 }
Exemplo n.º 6
0
    public static void SpeciesCountInProject_PieChart(Document document, Project currentProject)
    {
    	try {
	    	General_queries projq =new General_queries(currentProject);
	    	List<SpeciesStats> stats = projq.AllStatsBySpecies;
	    	
	    	double[] speciesCount=new double[stats.Count];
	    	string[] speciesNames=new string[stats.Count];
	    	
	    	double speciesSum=0;
	    	
	    	for(int i=0; i<stats.Count;i++)
	    	{
	    		speciesSum += stats[i].SpeciesPictures;
	    		speciesCount[i]=stats[i].SpeciesCount;
	    		speciesNames[i]=stats[i].SpeciesName;
	    	}
	    	
	    	document.LastSection.AddParagraph("Species count in project", "Heading2");
	
	      	Chart chart = new Chart();
	      	chart.Type=ChartType.Pie2D;
			chart.Left = 0;
		
		    chart.Width = Unit.FromCentimeter(10);
		    chart.Height = Unit.FromCentimeter(8);
		    
		    Series series = chart.SeriesCollection.AddSeries();
		    series.Add(speciesCount);
		    XSeries xseries = chart.XValues.AddXSeries();
		    xseries.Add(speciesNames);
		    
		    chart.RightArea.AddLegend();
		    
		    chart.DataLabel.Type = DataLabelType.Percent;
		    chart.DataLabel.Position = DataLabelPosition.OutsideEnd;
		    
		
		    document.LastSection.Add(chart);
    	} catch (Exception ex) {
    		throw ex;
    	}
    	
    	
    }
Exemplo n.º 7
0
 /// <summary>
 /// Adds a new chart to the cell.
 /// </summary>
 public void Add(Chart chart)
 {
   this.Elements.Add(chart);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Adds a new chart to the text frame.
 /// </summary>
 public void Add(Chart chart)
 {
     Elements.Add(chart);
 }
Exemplo n.º 9
0
 // Chart
 internal virtual void VisitChart(Chart chart) { }
Exemplo n.º 10
0
    public static void SpeciesTimeBehavior_BarChart(Document document, Project currentProject)
    {
    	try {
    		
    		General_queries projq =new General_queries(currentProject);
    		
    		
    		foreach(SpeciesStats spst in projq.AllStatsBySpecies)
    		{

    			document.LastSection.AddParagraph(spst.SpeciesName + " Activity Patterns", "Heading2");

    			Chart chart = new Chart();
    			chart.Left = 0;

    			chart.Width = Unit.FromCentimeter(16);
    			chart.Height = Unit.FromCentimeter(12);
    			Series series = chart.SeriesCollection.AddSeries();
    			series.ChartType = ChartType.Column2D;
    			series.Add(spst.ActivityPatern);
    			series.HasDataLabel = true;

    			XSeries xseries = chart.XValues.AddXSeries();
    			xseries.Add("0","1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14","15","16","17","18","19","20","21","22","23");

    			chart.XAxis.MajorTickMark = TickMarkType.Outside;
    			chart.XAxis.Title.Caption = "Hours of day";
    			
    			chart.YAxis.MajorTickMark = TickMarkType.Outside;
    			chart.YAxis.HasMajorGridlines = true;
    			chart.YAxis.MajorGridlines.LineFormat.Color=Colors.DarkGray;
    			chart.YAxis.Title.Caption = "Freq";

    			chart.PlotArea.LineFormat.Color = Colors.DarkGray;
    			chart.PlotArea.LineFormat.Width = 1;

    			document.LastSection.Add(chart);
    		
    		}
      
    	} catch (Exception ex) {
    		throw ex;
    	}
    }
Exemplo n.º 11
0
 /// <summary>
 /// Adds a new chart with the specified type to the collection.
 /// </summary>
 public Chart AddChart()
 {
   Chart chart = new Chart();
   chart.Type = ChartType.Line;
   Add(chart);
   return chart;
 }
        public Chart GetHeightChart(List<ChildMeasurement> measurements)
        {
            HeightChart = new Chart(ChartType.Line);
            Series series = HeightChart.SeriesCollection.AddSeries();
            series.Name = "Height";
            List<double> heightList = new List<double>();
            List<string> dateList = new List<string>();

            foreach (ChildMeasurement msr in measurements)
            {
                heightList.Add(msr.Height);
                dateList.Add(msr.Created.ToString("yyyy-MM-dd"));
            }

            series.Add(heightList.ToArray());

            HeightChart.XAxis.MajorTickMark = TickMarkType.Outside;
            HeightChart.XAxis.Title.Caption = "X-Axis";

            HeightChart.YAxis.MajorTickMark = TickMarkType.Outside;
            HeightChart.YAxis.Title.Caption = "Y-Axis";
            HeightChart.YAxis.HasMajorGridlines = true;

            HeightChart.PlotArea.LineFormat.Color = Colors.Black;
            HeightChart.PlotArea.LineFormat.Width = 1;
            HeightChart.PlotArea.LineFormat.Visible = true;

            HeightChart.Width = 5;
            //HeightChart.Legend.Docking = DockingType.Bottom;
           // HeightChart.Legend.LineFormat.Visible = true;

            XSeries xseries = HeightChart.XValues.AddXSeries();
            xseries.Add(dateList.ToArray());
            return HeightChart;
        }
Exemplo n.º 13
0
 internal ChartRenderer(XGraphics gfx, RenderInfo renderInfo, FieldInfos fieldInfos)
     : base(gfx, renderInfo, fieldInfos)
 {
     this.chart = (Chart)renderInfo.DocumentObject;
 }
Exemplo n.º 14
0
        /// <summary>
        /// Converts TextArea into DDL.
        /// </summary>
        internal override void Serialize(Serializer serializer)
        {
            Chart chartObject = _parent as Chart;

            serializer.WriteLine("\\" + chartObject.CheckTextArea(this));
            int pos = serializer.BeginAttributes();

            if (!_style.IsNull)
            {
                serializer.WriteSimpleAttribute("Style", Style);
            }
            if (!IsNull("Format"))
            {
                _format.Serialize(serializer, "Format", null);
            }

            if (!_topPadding.IsNull)
            {
                serializer.WriteSimpleAttribute("TopPadding", TopPadding);
            }
            if (!_leftPadding.IsNull)
            {
                serializer.WriteSimpleAttribute("LeftPadding", LeftPadding);
            }
            if (!_rightPadding.IsNull)
            {
                serializer.WriteSimpleAttribute("RightPadding", RightPadding);
            }
            if (!_bottomPadding.IsNull)
            {
                serializer.WriteSimpleAttribute("BottomPadding", BottomPadding);
            }

            if (!_width.IsNull)
            {
                serializer.WriteSimpleAttribute("Width", Width);
            }
            if (!_height.IsNull)
            {
                serializer.WriteSimpleAttribute("Height", Height);
            }

            if (!_verticalAlignment.IsNull)
            {
                serializer.WriteSimpleAttribute("VerticalAlignment", VerticalAlignment);
            }

            if (!IsNull("LineFormat"))
            {
                _lineFormat.Serialize(serializer);
            }
            if (!IsNull("FillFormat"))
            {
                _fillFormat.Serialize(serializer);
            }

            serializer.EndAttributes(pos);

            serializer.BeginContent();
            if (_elements != null)
            {
                _elements.Serialize(serializer);
            }
            serializer.EndContent();
        }