Ejemplo n.º 1
0
        public ViewModel()
        {
            Series = new ObservableCollection <ISeries>
            {
                new LineSeries <double>
                {
                    Values = new ObservableCollection <double> {
                        200, 558, 458, 249, 457, 339, 587
                    },
                }
            };

            XAxes = new List <Axis>
            {
                new Axis
                {
                    Name = "أهلا", // sample strings => "こんにちは" "你好" "أهلا"

                    NamePaint = new SolidColorPaint
                    {
                        Color      = SKColors.Red,
                        FontFamily = LiveChartsSkiaSharp.MatchChar('أ'), // Arab
                        //FontFamily = LiveChartsSkiaSharp.MatchChar('あ'), // Japanease
                        //FontFamily = LiveChartsSkiaSharp.MatchChar('你') // Chinese 汉语 sample
                        //FontFamily = "Times New Roman"
                    },

                    // Use the Label property to indicate the format of the labels in the axis
                    // The Labeler takes the value of the label as parameter and must return it as string
                    Labeler = (value) => "Day " + value,

                    // The MinStep property lets you define the minimum separation (in chart values scale)
                    // between every axis separator, in this case we don't want decimals,
                    // so lets force it to be greater or equals than 1
                    MinStep = 1
                }
            };

            YAxes = new List <Axis>
            {
                new Axis
                {
                    Name = "Sales",

                    // Now the Y axis we will display it as currency
                    // LiveCharts provides some common formatters
                    // in this case we are using the currency formatter.
                    Labeler = Labelers.Currency

                              // you could also build your own currency formatter
                              // for example:
                              // Labeler = (value) => value.ToString("C")

                              // But the one that LiveCharts provides creates shorter labels when
                              // the amount is in millions or trillions
                }
            };
        }
Ejemplo n.º 2
0
    public ViewModel()
    {
        Series = new ISeries[]
        {
            new ColumnSeries <double> {
                Values = new double[] { 426, 583, 104 }
            },
            new LineSeries <double> {
                Values = new double[] { 200, 558, 458 }, Fill = null
            },
        };

        XAxes = new List <Axis>
        {
            new Axis
            {
                Name      = "Salesman/woman",
                NamePaint = new SolidColorPaint {
                    Color = SKColors.Red
                },
                Labels      = new string[] { "王", "赵", "张" },
                LabelsPaint = new SolidColorPaint
                {
                    Color = SKColors.Black,
                    // you need to enable the Chinease characters for SkiaSharp
                    // Livecharts provides the MatchChar() function that relays on the
                    // SKFontManager.Default.MatchCharacter() SkiaSharp function.
                    FontFamily = LiveChartsSkiaSharp.MatchChar('汉') // 汉语 // mark
                                                                    //FontFamily = LiveChartsSkiaSharp.MatchChar('أ'), // Arab
                                                                    //FontFamily = LiveChartsSkiaSharp.MatchChar('あ'), // Japanease
                                                                    //FontFamily = LiveChartsSkiaSharp.MatchChar('Ж'), // Russian
                }
            }
        };

        YAxes = new List <Axis>
        {
            new Axis
            {
                Name        = "Sales amount",
                NamePadding = new LiveChartsCore.Drawing.Padding(0, 15),
                Labeler     = Labelers.Currency
            }
        };
    }