Ejemplo n.º 1
0
        public string CreateVectorBarChartPdfReport()
        {
            var fonts = new GenericFontProvider(
                TestUtils.GetVerdanaFontPath(),
                TestUtils.GetTahomaFontPath());

            var finalFile = Path.Combine(TestUtils.GetOutputFolder(), "BarChartPdfReport.pdf");

            var document = new Document(PageSize.A4);

            var fileStream = new FileStream(finalFile, FileMode.Create);
            var writer     = PdfWriter.GetInstance(document, fileStream);

            document.AddAuthor("Vahid");
            document.Open();
            var canvas = writer.DirectContent;

            var items = new List <BarChartItem>
            {
                new BarChartItem(10, "Item 1 caption", new BaseColor(130, 197, 91)),
                new BarChartItem(100, "Item 2 caption", new BaseColor(95, 182, 85)),
                new BarChartItem(60, "Item 3 caption", new BaseColor(130, 197, 91)),
                new BarChartItem(70, "Item 4 caption", new BaseColor(88, 89, 91)),
                new BarChartItem(120, "Item 5 caption", new BaseColor(173, 216, 230)),
                new BarChartItem(0, "Item 6 caption", BaseColor.Yellow),
                new BarChartItem(210, "Item 7 caption", BaseColor.Magenta),
                new BarChartItem(150, "Item 8 caption", BaseColor.Orange),
                new BarChartItem(50, "Item 9 caption", BaseColor.Pink),
                new BarChartItem(20, "Item 10 caption", BaseColor.Cyan),
                new BarChartItem(100, "Item 11 caption", BaseColor.Blue),
                new BarChartItem(90, "عنوان آيتم 12", BaseColor.Green),
            };

            var img = new VerticalBarChart
            {
                PdfFont     = fonts,
                ContentByte = canvas,
                Items       = items
            }.Draw();

            document.Add(img);

            var img2 = new HorizontalBarChart
            {
                PdfFont     = fonts,
                ContentByte = canvas,
                Items       = items
            }.Draw();

            document.Add(img2);

            document.Close();
            fileStream.Dispose();

            return(finalFile);
        }
Ejemplo n.º 2
0
    public void LoadContent(int customerId)
    {
        DateTime startDate = GetSalesStartDate();
        DateTime endDate   = GetSalesEndDate();

        HorizontalBarChart.Title = DateTimeHelper.GetDateRangeString(startDate, endDate);
        HorizontalBarChart.SetData(SalesProvider.GetCustomerPurchasesGroupedByProduct(customerId, startDate, endDate));
        using (CustomersProvider provider = new CustomersProvider())
            Location = provider.GetCustomerLocation(customerId);
        CustomerDetailsHolder.Visible  = true;
        EmptyDataMessageHolder.Visible = false;
    }
Ejemplo n.º 3
0
        public string CreatePdfReport()
        {
            var fonts = new GenericFontProvider(
                Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\tahoma.TTF"),
                Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\verdana.ttf"));

            var finalFile = Path.Combine(AppPath.ApplicationPath, "Pdf\\BarChartPdfReport.pdf");

            using (var document = new Document(PageSize.A4))
            {
                var writer = PdfWriter.GetInstance(document, new FileStream(finalFile, FileMode.Create));
                document.Open();
                var canvas = writer.DirectContent;

                var items = new List <BarChartItem>
                {
                    new BarChartItem(10, "Item 1 caption", new BaseColor(130, 197, 91)),
                    new BarChartItem(100, "Item 2 caption", new BaseColor(95, 182, 85)),
                    new BarChartItem(60, "Item 3 caption", new BaseColor(130, 197, 91)),
                    new BarChartItem(70, "Item 4 caption", new BaseColor(88, 89, 91)),
                    new BarChartItem(120, "Item 5 caption", new BaseColor(173, 216, 230)),
                    new BarChartItem(0, "Item 6 caption", BaseColor.YELLOW),
                    new BarChartItem(210, "Item 7 caption", BaseColor.MAGENTA),
                    new BarChartItem(150, "Item 8 caption", BaseColor.ORANGE),
                    new BarChartItem(50, "Item 9 caption", BaseColor.PINK),
                    new BarChartItem(20, "Item 10 caption", BaseColor.CYAN),
                    new BarChartItem(100, "Item 11 caption", BaseColor.BLUE),
                    new BarChartItem(90, "عنوان آيتم 12", BaseColor.GREEN),
                };

                var img = new VerticalBarChart
                {
                    PdfFont     = fonts,
                    ContentByte = canvas,
                    Items       = items
                }.Draw();
                document.Add(img);

                var img2 = new HorizontalBarChart
                {
                    PdfFont     = fonts,
                    ContentByte = canvas,
                    Items       = items
                }.Draw();
                document.Add(img2);
            }

            return(finalFile);
        }
Ejemplo n.º 4
0
        // Acción que determina que clase utilitzar para crear los "Charts"
        public void CrearChart(Button button, Label label = null)
        {
            ClearLastElements();

            BaseChart.Chart.Series.RemoveAllSeries();

            //Themes.RefreshTheme();
            Themes.BasicAxes(BaseChart.Chart.Axes.Left, BaseChart.Chart.Axes.Right);
            Themes.AplicarTheme(BaseChart);

            switch (button.Text)
            {
            case "Line":
                lineChart = new LineChart(BaseChart);
                break;

            case "Column Bar":
                columnBarChart = new ColumnBarChart(BaseChart);
                break;

            case "Area":
                areaChart = new AreaChart(BaseChart);
                break;

            case "Pie":
                pieChart = new PieChart(BaseChart);
                break;

            case "Fast Line":
                fastLineChart = new FastLineChart(BaseChart);
                break;

            case "Horizontal Area":
                horizAreaChart = new HorizontalAreaChart(BaseChart);
                break;

            case "Horizontal Bar":
                horizBarChart = new HorizontalBarChart(BaseChart);
                break;

            case "Horizontal Line":
                horizLineChart = new HorizontalLineChart(BaseChart);
                break;

            case "Donut":
                donutChart = new DonutChart(BaseChart);
                break;

            case "Bubble":
                bubbleChart = new BubbleChart(BaseChart);
                break;

            case "Shape":
                shapeChart = new ShapeChart(BaseChart);
                break;

            case "Gantt":
                gantChart = new GanttChart(BaseChart);
                break;

            case "Point/Scatter":
                point_scatterChart = new Point_ScatterChart(BaseChart);
                break;

            case "Interpolating Line":
                interpolatingChart = new InterpolatingChartFeatures(BaseChart);
                break;

            case "Bar Styles":
                coneBarChart = new BarStylesChartFeatures(BaseChart);
                break;

            case "Zoom & Panning":
                zoomPaningArrowChart = new ZoomPanningChartFeatures(BaseChart);
                break;

            case "Bar Gradient":
                gradientBarChart = new GradientBarChartFeatures(BaseChart);
                break;

            case "Bubble Transparent":
                bubbleTranspChart = new BubbleTransparencyChartFeatures(BaseChart);
                break;

            case "Real Time":
                fLineRealTimeChart = new FLineRealTimeChartFeatures(BaseChart);
                break;

            case "Stack Area":
                stackAreaChart = new StackAreaChartFeatures(BaseChart);
                break;

            case "Multiple Pies":
                multiPiesChart = new MultiplePiesChartFeatures(BaseChart);
                break;

            case "Semi-Pie":
                semiPieChart = new Semi_PieChartFeatures(BaseChart);
                break;

            case "Semi-Donut":
                semiDonutChart = new Semi_DonutChartFeatures(BaseChart);
                break;

            case "Arrow":
                arrowChart = new ArrowChart(BaseChart);
                break;

            case "Polar":
                polarChart = new PolarChart(BaseChart);
                break;

            case "Radar":
                radarChart = new RadarChart(BaseChart);
                break;

            case "Pyramid":
                pyramidChart = new PyramidChart(BaseChart);
                break;

            case "Candle":
                candleChart = new CandleChart(BaseChart);
                break;

            case "Histogram":
                histogramChart = new HistogramChart(BaseChart);
                break;

            case "Error":
                errorChart = new ErrorChart(BaseChart);
                break;

            case "ErrorBar":
                errorBarChart = new ErrorBarChart(BaseChart);
                break;

            case "Funnel":
                funnelChart = new FunnelChart(BaseChart);
                break;

            case "Smith":
                smithChart = new SmithChart(BaseChart);
                break;

            case "Bezier":
                bezierChart = new BezierChart(BaseChart);
                break;

            case "HighLow":
                highLowChart = new HighLowChart(BaseChart);
                break;

            case "Speed Time":
                realTimeChart = new SpeedTimeChart(BaseChart);
                break;

            case "Waterfall":
                waterfallChart = new WaterfallChart(BaseChart);
                break;

            case "Volume":
                volumeChart = new VolumeChart(BaseChart);
                break;

            case "Color Grid":
                colorGridChart = new ColorGridChart(BaseChart);
                break;

            case "Polar Bar":
                polarBarChart = new PolarBarChart(BaseChart);
                break;

            case "Inverted Pyramid":
                invertedPyramidChart = new InvertedPyramidChart(BaseChart);
                break;

            case "Horizontal Histogram":
                horizHistogramChart = new HorizHistogramChart(BaseChart);
                break;

            case "Circular Gauge":
                basicCircGaugeChart = new BasicCircularGaugeChart(BaseChart);
                break;

            case "Car Fuel":
                carFuelChart = new CarFuelChart(BaseChart);
                break;

            case "Custom Hand":
                custPointerGaugeChart = new CustomPointerChart(BaseChart);
                break;

            case "Acceleration":
                accelerationCircularGaugeChart = new AccelerationCircularGaugeChart(BaseChart);
                break;

            case "Knob Gauge":
                basicKnobGaugeChart = new BasicKnobGaugeChart(BaseChart);
                break;

            case "Temperature Knob":
                temperatureKnobChart = new TemperatureKnobChart(BaseChart);
                break;

            case "Compass":
                try { compassChart = new CompassChart(BaseChart); }
                catch (Exception e) {  }
                break;

            case "Map GIS":
                mapGSIChart = new MapGISChart(BaseChart);
                break;

            case "World Map":
                worldMapChart = new WorldMapChart(BaseChart);
                break;

            case "TreeMap":
                treeMapChart = new TreeMapChart(BaseChart);
                break;

            case "Basic Clock":
                basicClockChart = new BasicClockChart(BaseChart);
                break;

            case "Custom Clock":
                customClockChart = new CustomClockChart(BaseChart);
                break;

            case "Organizational Chart":
                basicOrganizationalChart = new BasicOrganizationalChart(BaseChart);
                break;

            case "Numeric Gauge":
                numericGaugeChart = new NumericGaugeChart(BaseChart);
                break;

            case "Linear Gauge":
                linearGaugeChart = new LinearGaugeChart(BaseChart);
                break;

            case "Scales":
                scalesLinearChart = new ScalesLinearChart(BaseChart);
                break;

            case "SubLines":
                moreLinesLinearChart = new MoreLinesLinearChart(BaseChart);
                break;

            case "Mobile Battery":
                batteryLinearChart = new BatteryLinearChart(BaseChart);
                break;

            case "Basic Calendar":
                basicCalendarChart = new BasicCalendarChart(BaseChart, label);
                break;

            case "Special Dates":
                specialDatesChart = new SpecialDatesChart(BaseChart, label);
                break;

            case "TagCloud":
                tagCloudChart = new TagCloudChart(BaseChart);
                break;

            case "Add":
                addStdFunctionsChart = new AddStdFunctionsChart(BaseChart);
                break;

            case "Subtract":
                subtStdFunctionsChart = new SubtStdFunctionsChart(BaseChart);
                break;

            case "Multiply":
                multStdFunctionsChart = new MultStdFunctionsChart(BaseChart);
                break;

            case "Divide":
                divStdFunctionsChart = new DivStdFunctionsChart(BaseChart);
                break;

            case "Count":
                countStdFunctionsChart = new CountStdFunctionsChart(BaseChart);
                break;

            case "Average":
                avgStdFunctionsChart = new AvgStdFunctionsChart(BaseChart);
                break;

            case "High":
                highStdFunctionsChart = new HighStdFunctionsChart(BaseChart);
                break;

            case "Low":
                lowStdFunctionsChart = new LowStdFunctionsChart(BaseChart);
                break;

            case "Median Function":
                medianStdFunctionsChart = new MedianStdFunctionsChart(BaseChart);
                break;

            case "Percent Change":
                percentStdFunctionsChart = new PercentStdFunctionsChart(BaseChart);
                break;

            case "ADX":
                adxProFunctionChart = new ADXProFunctionChart(BaseChart);
                break;

            case "AC":
                acProFunctionChart = new ACProFunctionChart(BaseChart);
                break;

            case "Alligator":
                alligatorProFunctionChart = new AlligatorProFunctionChart(BaseChart);
                break;

            case "AO":
                aoProFunctionChart = new AOProFunctionChart(BaseChart);
                break;

            case "ATR":
                atrProFunctionChart = new ATRProFunctionChart(BaseChart);
                break;

            case "Bollinger Bands":
                bollingerProFunctionChart = new BollingerProFunctionChart(BaseChart);
                break;

            case "CCI":
                cciProFunctionChart = new CCIProFunctionChart(BaseChart);
                break;

            case "CLV":
                clvProFunctionChart = new CLVProFunctionChart(BaseChart);
                break;

            case "Compression OHLC":
                compressionOHLCProFunctionChart = new CompressionOHLCProFunctionChart(BaseChart);
                break;

            case "Exp. Average":
                expAverageProFunctionChart = new ExpAverageProFunctionChart(BaseChart);
                break;

            case "Exp. Moving Average":
                expMovAverageProFunctionChart = new ExpMovAverageProFunctionChart(BaseChart);
                break;

            case "Gator Oscillator":
                gatorOscillProFunctionChart = new GatorOscillProFunctionChart(BaseChart);
                break;

            case "Kurtosis":
                kurtosisProFunctionChart = new KurtosisProFunctionChart(BaseChart);
                break;

            case "MACD":
                macdProFunctionChart = new MACDProFunctionChart(BaseChart);
                break;

            case "Momentum":
                momentumProFunctionChart = new MomentumProFunctionChart(BaseChart);
                break;

            case "Momentum Div.":
                momentumDivProFunctionChart = new MomentumDivProFunctionChart(BaseChart);
                break;

            case "Money Flow":
                moneyFlowProFunctionChart = new MoneyFlowProFunctionChart(BaseChart);
                break;

            case "OBV":
                obvProFunctionChart = new OBVProFunctionChart(BaseChart);
                break;

            case "PVO":
                pvoProFunctionChart = new PVOProFunctionChart(BaseChart);
                break;

            case "RSI":
                rsiProFunctionChart = new RSIProFunctionChart(BaseChart);
                break;

            case "RVI":
                rviProFunctionChart = new RVIProFunctionChart(BaseChart);
                break;

            case "Slope":
                slopeProFunctionChart = new SlopeProFunctionChart(BaseChart);
                break;

            case "Smoothed Mov Avg":
                smoothMovAvgProFunctionChart = new SmoothMovAvgProFunctionChart(BaseChart);
                break;

            case "S.A.R.":
                sarProFunctionChart = new SARProFunctionChart(BaseChart);
                break;

            case "Cross Point":
                crossPointsProFunctionsChart = new CrossPointsProFunctionsChart(BaseChart);
                break;

            case "Correlation":
                correlationProFunctionChart = new CorrelationProFunctionChart(BaseChart);
                break;

            case "Cumulative":
                cumulativeProFunctionChart = new CumulativeProFunctionChart(BaseChart);
                break;

            case "Custom Function":
                calculateEventProFunctionChart = new CalculateEventProFunctionChart(BaseChart);
                break;

            case "Exponential Trend":
                exponentialTrendProFunctionChart = new ExponentialTrendProFunctionChart(BaseChart);
                break;

            case "Fitting Linearizable":
                fittingProFunctionChart = new FittingProFunctionChart(BaseChart);
                break;

            case "Performance":
                performanceProFunctionChart = new PerformanceProFunctionChart(BaseChart);
                break;

            case "Perimeter":
                perimeterProFunctionChart = new PerimeterProFunctionChart(BaseChart);
                break;

            case "Finding Coefficients":
                findCoeffProFunctionChart = new FindCoeffProFunctionChart(BaseChart);
                break;

            case "Down Sampling":
                downSamplingProFunctionChart = new DownSamplingProFunctionChart(BaseChart);
                break;

            case "RMS":
                rmsProFunctionChart = new RMSProFunctionChart(BaseChart);
                break;

            case "Smoothing Function":
                smoothingProFunctionChart = new SmoothingProFunctionChart(BaseChart);
                break;

            case "Standard Deviation":
                stdDeviationProFunctionChart = new StdDeviationProFunctionChart(BaseChart);
                break;

            case "Trendline":
                trendlineProFunctionChart = new TrendlineProFunctionChart(BaseChart);
                break;

            case "Variance":
                varianceProFunctionChart = new VarianceProFunctionChart(BaseChart);
                break;

            case "SPC":
                spcProFunctionChart = new SPCProFunctionChart(BaseChart);
                break;

            case "Cumulative Histogram":
                cumulativeHistogProFunctionChart = new CumulativeHistogProFunctionChart(BaseChart);
                break;

            case "Skewness":
                skewnessProFunctionChart = new SkewnessProFunctionChart(BaseChart);
                break;
            }

            Themes.AplicarOptions(BaseChart);
        }
Ejemplo n.º 5
0
 public HorizontalBarChartView()
 {
     Chart = new HorizontalBarChart();
 }
Ejemplo n.º 6
0
 public void SetData(IEnumerable <ChartData> data)
 {
     DoughnutChart.SetData(data);
     HorizontalBarChart.SetData(data);
 }
Ejemplo n.º 7
0
 public HorizontalBarChartView() : base(ChartType.HorizontalBarChart)
 {
     Chart = new HorizontalBarChart();
 }