コード例 #1
0
ファイル: ChartOptions.cs プロジェクト: codesoda/FluentFlot
        public FlotChartOptions Legend(Action<LegendOptions> legendBuilder)
        {
            if (_legendOptions == null)
                _legendOptions = new LegendOptions();

            legendBuilder(_legendOptions);

            return this;
        }
コード例 #2
0
        public FlotChartOptions Legend(Action <LegendOptions> legendBuilder)
        {
            if (_legendOptions == null)
            {
                _legendOptions = new LegendOptions();
            }

            legendBuilder(_legendOptions);

            return(this);
        }
コード例 #3
0
        private AxisOptions getAxisOptions(CurveChart chart, AxisTypes yAxisType)
        {
            var legendOptions = new LegendOptions
            {
                LegendPosition  = getLegendPosition(chart.ChartSettings.LegendPosition),
                LegendAlignment = LegendOptions.LegendAlignments.left,
                FontSize        = LegendOptions.FontSizes.scriptsize,
                RoundedCorners  = false
            };

            var axisOptions = new AxisOptions(DefaultConverter.Instance)
            {
                LegendOptions   = legendOptions,
                Title           = chart.Title,
                BackgroundColor = chart.ChartSettings.DiagramBackColor.Name,
                EnlargeLimits   = chart.ChartSettings.SideMarginsEnabled
            };

            foreach (var axis in chart.Axes)
            {
                if (axis.AxisType == AxisTypes.X)
                {
                    axisOptions.XLabel = getAxisLabel(axis);
                    axisOptions.XMax   = axis.Max;
                    axisOptions.XMin   = axis.Min;
                    var unit = axis.Dimension.Unit(axis.UnitName);

                    axisOptions.XMajorGrid = axis.GridLines;
                    axisOptions.XMode      = getAxisMode(axis.Scaling);

                    axisOptions.XAxisPosition = AxisOptions.AxisXLine.box;
                    axisOptions.XAxisArrow    = false;
                }
                else if (axis.AxisType == yAxisType)
                {
                    axisOptions.YLabel = getAxisLabel(axis);
                    axisOptions.YMax   = axis.Max;
                    axisOptions.YMin   = axis.Min;

                    axisOptions.YMajorGrid = axis.GridLines;
                    axisOptions.YMode      = getAxisMode(axis.Scaling);

                    axisOptions.YAxisPosition = AxisOptions.AxisYLine.left;
                    axisOptions.YAxisArrow    = false;
                }
            }

            return(axisOptions);
        }
コード例 #4
0
        private void ExportMapButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            this.IsBusy = true;
            linkExportResult.Visibility = System.Windows.Visibility.Collapsed;
            PrintParameters printParams = new PrintParameters(this.MapControl);

            printParams.Format = (string)boxExportFormats.SelectedItem;

            ExportOptions expOptions = new ExportOptions()
            {
                Dpi = 96
            };

            expOptions.OutputSize = new Size(this.MapControl.ActualWidth, this.MapControl.ActualHeight);

            LegendOptions      legendOptions = new LegendOptions();
            List <LegendLayer> legendLayers  = new List <LegendLayer>();

            foreach (LivingMapLayer layer in this.AppConfig.MapConfig.LivingMaps)
            {
                if (this.MapControl.Layers[layer.ID] is ArcGISDynamicMapServiceLayer)
                {
                    int[]         visibleLayers = (this.MapControl.Layers[layer.ID] as ArcGISDynamicMapServiceLayer).VisibleLayers;
                    List <object> layerIDs      = new List <object>();
                    foreach (int lyrID in visibleLayers)
                    {
                        layerIDs.Add(lyrID);
                    }
                    legendLayers.Add(new LegendLayer()
                    {
                        LayerId = layer.ID, SubLayerIds = layerIDs
                    });
                }
                else
                {
                    legendLayers.Add(new LegendLayer()
                    {
                        LayerId = layer.ID
                    });
                }
            }

            legendOptions.LegendLayers = legendLayers;
            ScaleBarOptions scaleOptions   = new ScaleBarOptions();
            string          metricUnits    = (boxMetricUnits.SelectedItem as ComboBoxItem).Content as string;
            string          nonmetricUnits = (boxNonmetricUnits.SelectedItem as ComboBoxItem).Content as string;

            scaleOptions.MetricUnit     = (ScaleBarOptions.MetricUnits)Enum.Parse(typeof(ScaleBarOptions.MetricUnits), metricUnits, true);
            scaleOptions.MetricLabel    = txtMetricLabel.Text;
            scaleOptions.NonMetricUnit  = (ScaleBarOptions.NonMetricUnits)Enum.Parse(typeof(ScaleBarOptions.NonMetricUnits), nonmetricUnits, true);
            scaleOptions.NonMetricLabel = txtNonmetricLabel.Text;

            LayoutOptions layoutOptions = new LayoutOptions()
            {
                LegendOptions = legendOptions, ScaleBarOptions = scaleOptions
            };

            layoutOptions.Title     = txtExportMapTitle.Text;
            layoutOptions.Copyright = txtCopyright.Text;

            printParams.ExportOptions  = expOptions;
            printParams.LayoutOptions  = layoutOptions;
            printParams.LayoutTemplate = (string)boxLayoutTemplates.SelectedItem;

            if (isAsynPrintService)
            {
                printTask.SubmitJobAsync(printParams);
            }
            else
            {
                printTask.ExecuteAsync(printParams);
            }
        }