Skip to content

Commit

Permalink
Merge pull request #1143 from beto-rodriguez/dev
Browse files Browse the repository at this point in the history
2.0.0-beta.900
  • Loading branch information
beto-rodriguez authored Jul 30, 2023
2 parents bba2cd1 + 419dadb commit d7c8ee3
Show file tree
Hide file tree
Showing 128 changed files with 1,840 additions and 1,152 deletions.
25 changes: 22 additions & 3 deletions docs/cartesianChart/axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,29 @@ not cover all of them, if you need to know more about this type then use the [AP

Both of these features are directly related to the <a href="#MaxLimit and MinLimit properties">MaxLimit and MinLimit properties</a>,
zooming occurs when the mouse wheel moves or when the pinch gesture occurs, the panning is called when the pointer goes down,
moves and then goes up
moves and then goes up or when the pinch gesture occurs.

Zooming is disabled by default, you must set the `ZoomMode` property to `X`, `Y` or `Both`, normally the `X` mode is the most accurate
for horizontal series (LineSeries, ColumnSeries), the `Y` mode for vertical series (RowSeries) and the `Both` mode for Heat or Scatter series.
Zooming and panning is disabled by default, you can enable it by setting the `ZoomMode` property, this property is of type
[ZoomAndPanMode](https://lvcharts.com/api/{{ version }}/LiveChartsCore.Measure.ZoomAndPanMode) and the options are:

- `X`: Enables zooming and panning on the X axis.
- `Y`: Enables zooming and panning on the Y axis.
- `Both`: Enables zooming and panning on both axes.
- `None`: Disables zooming and panning.
- `PanX`: Enables panning on the X axis.
- `PanY`: Enables panning on the Y axis.
- `ZoomX`: Enables zooming on the X axis.
- `ZoomY`: Enables zooming on the Y axis.

The [ZoomAndPanMode](https://lvcharts.com/api/{{ version }}/LiveChartsCore.Measure.ZoomAndPanMode) type is a flag enum,
so you can combine the options, for example, if you want to enable zooming on the X axis and panning on the Y axis you can
set the `ZoomMode` property to `ZoomAndPanMode.ZoomX | ZoomAndPanMode.PanY`.

There is also the `InvertPanningPointerTrigger` flag, when this flag is present the panning will be triggered using
the right click on desktop devices and the touch-and-hold gesture on touch devices, the `zoom by section` feature will be
triggered to the left click on desktop devices and the touch-and-hold gesture on touch devices.

Here are a few examples of the different zoom modes:

**X Mode:**

Expand Down
6 changes: 3 additions & 3 deletions docs/overview/1.2.install.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,9 @@ And that's it, start your application and you will see the chart.

## Configure themes, fonts or mappers (Optional)

Optionally you could configure LiveCharts to add a theme, register a global font or add a custom mapper for a type,
when you need a non-Latin font you must register a typeface so SkiaShap can render the text correctly,
add the following code when your application starts:
Optionally you could configure LiveCharts to add a theme, register a global font, enable `right to left` tooltips
or a custom mapper for a type, when you need a non-Latin font you must register a typeface so SkiaShap can render
the text correctly, add the following code when your application starts:

{{~ if avalonia ~}}

Expand Down
24 changes: 21 additions & 3 deletions docs/samples/lines/zoom/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,26 @@
{{ render this "~/shared/genericSampleJustGifHeader.md" }}

Zooming and panning is disabled by default, you can enable it by setting the `ZoomMode` property, this property is of type
`LiveChartsCore.Measure.ZoomAndPanMode` (enum) and the options are `X`, `Y`, `Both` and `None` (default), you can learn more
about zooming an panning [here](https://lvcharts.com/docs/{{ platform }}/{{ version }}/CartesianChart.Axes%20properties#zooming-and-panning).
[ZoomAndPanMode](https://lvcharts.com/api/{{ version }}/LiveChartsCore.Measure.ZoomAndPanMode) and the options are:

- `X`: Enables zooming and panning on the X axis.
- `Y`: Enables zooming and panning on the Y axis.
- `Both`: Enables zooming and panning on both axes.
- `None`: Disables zooming and panning.
- `PanX`: Enables panning on the X axis.
- `PanY`: Enables panning on the Y axis.
- `ZoomX`: Enables zooming on the X axis.
- `ZoomY`: Enables zooming on the Y axis.

The [ZoomAndPanMode](https://lvcharts.com/api/{{ version }}/LiveChartsCore.Measure.ZoomAndPanMode) type is a flag enum,
so you can combine the options, for example, if you want to enable zooming on the X axis and panning on the Y axis you can
set the `ZoomMode` property to `ZoomAndPanMode.ZoomX | ZoomAndPanMode.PanY`.

There is also the `InvertPanningPointerTrigger` flag, when this flag is present the panning will be triggered using
the right click on desktop devices and the touch-and-hold gesture on touch devices, the `zoom by section` feature will be
triggered to the left click on desktop devices and the touch-and-hold gesture on touch devices.

You can learn more about zooming an panning [here](https://lvcharts.com/docs/{{ platform }}/{{ version }}/CartesianChart.Axes%20properties#zooming-and-panning).

{{~ if desktop ~}}

Expand Down Expand Up @@ -43,4 +61,4 @@ In touch devices, pinch the screen in/out to zoom, hold tap and drag to move the
{{ full_name | get_view_from_docs }}
```

{{ render this "~/shared/relatedTo.md" }}
{{ render this "~/shared/relatedTo.md" }}
21 changes: 21 additions & 0 deletions samples/AvaloniaSample/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,25 @@
<Application.Styles>
<FluentTheme />
</Application.Styles>
<Application.Resources>
<ControlTheme x:Key="{x:Type Button}" TargetType="Button">
<Setter Property="Background" Value="#e8e8e8"/>
<Setter Property="Padding" Value="8"/>
<Setter Property="Template">
<ControlTemplate>
<Panel>
<Rectangle Fill="{TemplateBinding Background}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
<ContentPresenter x:Name="PART_ContentPresenter"
Content="{TemplateBinding Content}"
Margin="{TemplateBinding Padding}"/>
</Panel>
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="{x:Type TextBlock}" TargetType="TextBlock">
<Setter Property="Foreground" Value="#303030"/>
</ControlTheme>
</Application.Resources>
</Application>
6 changes: 4 additions & 2 deletions samples/AvaloniaSample/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ public override void Initialize()
LiveCharts.Configure(config => // mark
config // mark
// you can override the theme
// .AddDarkTheme() // mark
//.AddDarkTheme() // mark

// In case you need a non-Latin based font, you must register a typeface for SkiaSharp
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('汉')) // <- Chinese // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('أ')) // <- Arabic // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('あ')) // <- Japanese // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('헬')) // <- Korean // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('Ж')) // <- Russian // mark

//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('أ')) // <- Arabic // mark
//.UseRightToLeftSettings() // Enables right to left tooltips // mark

// finally register your own mappers
// you can learn more about mappers at:
// https://lvcharts.com/docs/{{ platform }}/{{ version }}/Overview.Mappers
Expand Down
16 changes: 16 additions & 0 deletions samples/AvaloniaSample/Axes/Crosshairs/View.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<UserControl x:Class="AvaloniaSample.Axes.Crosshairs.View"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
xmlns:vms="using:ViewModelsSamples.Axes.Crosshairs">
<UserControl.DataContext>
<vms:ViewModel/>
</UserControl.DataContext>
<Grid>
<lvc:CartesianChart
Series="{Binding Series}"
XAxes="{Binding XAxes}"
YAxes="{Binding YAxes}">
</lvc:CartesianChart>
</Grid>
</UserControl>
17 changes: 17 additions & 0 deletions samples/AvaloniaSample/Axes/Crosshairs/View.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace AvaloniaSample.Axes.Crosshairs;

public class View : UserControl
{
public View()
{
InitializeComponent();
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
2 changes: 1 addition & 1 deletion samples/AvaloniaSample/Pies/Basic/View.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
<UserControl.DataContext>
<vms:ViewModel/>
</UserControl.DataContext>
<lvc:PieChart Series="{Binding Series}" Title="{Binding Title}" LegendPosition="Right"/>
<lvc:PieChart Series="{Binding Series}" Title="{Binding Title}"/>
</UserControl>
13 changes: 13 additions & 0 deletions samples/BlazorSample/Pages/Axes/Crosshairs.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@page "/Axes/Crosshairs"
@using LiveChartsCore.SkiaSharpView.Blazor
@using ViewModelsSamples.Axes.Crosshairs

<CartesianChart
Series="ViewModel.Series"
XAxes="ViewModel.XAxes"
YAxes="ViewModel.YAxes">
</CartesianChart>

@code {
public ViewModel ViewModel { get; set; } = new();
}
1 change: 0 additions & 1 deletion samples/BlazorSample/Pages/Pies/Basic.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

<PieChart
Series="ViewModel.Series"
LegendPosition="LiveChartsCore.Measure.LegendPosition.Right"
Title="ViewModel.Title">
</PieChart>

Expand Down
24 changes: 24 additions & 0 deletions samples/EtoFormsSample/Axes/Crosshairs/View.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Eto.Forms;
using LiveChartsCore.SkiaSharpView.Eto;
using ViewModelsSamples.Axes.Crosshairs;

namespace EtoFormsSample.Axes.Crosshairs;

public class View : Panel
{
private readonly CartesianChart cartesianChart;

public View()
{
var viewModel = new ViewModel();

cartesianChart = new CartesianChart
{
Series = viewModel.Series,
XAxes = viewModel.XAxes,
YAxes = viewModel.YAxes,
};

Content = new DynamicLayout(cartesianChart);
}
}
3 changes: 1 addition & 2 deletions samples/EtoFormsSample/Pies/Basic/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public View()
pieChart = new PieChart
{
Series = viewModel.Series,
Title = viewModel.Title,
LegendPosition = LiveChartsCore.Measure.LegendPosition.Right,
Title = viewModel.Title
};

Content = pieChart;
Expand Down
7 changes: 4 additions & 3 deletions samples/EtoFormsSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ static void Main()
LiveCharts.Configure(config => // mark
config // mark
// you can override the theme
// .AddDarkTheme() // mark
.AddLightTheme() // mark
//.AddDarkTheme() // mark

// In case you need a non-Latin based font, you must register a typeface for SkiaSharp
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('汉')) // <- Chinese // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('أ')) // <- Arabic // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('あ')) // <- Japanese // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('헬')) // <- Korean // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('Ж')) // <- Russian // mark

//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('أ')) // <- Arabic // mark
//.UseRightToLeftSettings() // Enables right to left tooltips // mark

// finally register your own mappers
// you can learn more about mappers at:
// https://lvcharts.com/docs/{{ platform }}/{{ version }}/Overview.Mappers
Expand Down
4 changes: 3 additions & 1 deletion samples/MauiSample/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ protected override void OnStart()

// In case you need a non-Latin based font, you must register a typeface for SkiaSharp
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('汉')) // <- Chinese // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('أ')) // <- Arabic // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('あ')) // <- Japanese // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('헬')) // <- Korean // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('Ж')) // <- Russian // mark

//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('أ')) // <- Arabic // mark
//.UseRightToLeftSettings() // Enables right to left tooltips // mark

// finally register your own mappers
// you can learn more about mappers at:
// https://lvcharts.com/docs/{{ platform }}/{{ version }}/Overview.Mappers
Expand Down
22 changes: 22 additions & 0 deletions samples/MauiSample/Axes/Crosshairs/View.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="MauiSample.Axes.Crosshairs.View"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui"
xmlns:vms="clr-namespace:ViewModelsSamples.Axes.Crosshairs;assembly=ViewModelsSamples"
>
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<lvc:CartesianChart
Series="{Binding Series}">
</lvc:CartesianChart>
</Grid>
</ContentPage.Content>
</ContentPage>
10 changes: 10 additions & 0 deletions samples/MauiSample/Axes/Crosshairs/View.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace MauiSample.Axes.Crosshairs;

[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class View : ContentPage
{
public View()
{
InitializeComponent();
}
}
3 changes: 1 addition & 2 deletions samples/MauiSample/Pies/Basic/View.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
</ContentPage.BindingContext>
<lvc:PieChart
Series="{Binding Series}"
Title="{Binding Title}"
LegendPosition="Right">
Title="{Binding Title}">
</lvc:PieChart>
</ContentPage>
2 changes: 1 addition & 1 deletion samples/UWPSample/Pies/Basic/View.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
<UserControl.DataContext>
<vms:ViewModel/>
</UserControl.DataContext>
<lvc:PieChart Series="{Binding Series}" Title="{Binding Title}" LegendPosition="Right"/>
<lvc:PieChart Series="{Binding Series}" Title="{Binding Title}"/>
</UserControl>
28 changes: 4 additions & 24 deletions samples/UnoPlatformSample/UnoPlatformSample/App.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
// The MIT License(MIT)
//
// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using LiveChartsCore; // mark
using LiveChartsCore; // mark
using LiveChartsCore.SkiaSharpView; // mark
using SkiaSharp; // mark

Expand All @@ -42,11 +20,13 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args)

// In case you need a non-Latin based font, you must register a typeface for SkiaSharp
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('汉')) // <- Chinese // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('أ')) // <- Arabic // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('あ')) // <- Japanese // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('헬')) // <- Korean // mark
//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('Ж')) // <- Russian // mark

//.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('أ')) // <- Arabic // mark
//.UseRightToLeftSettings() // Enables right to left tooltips // mark

// finally register your own mappers
// you can learn more about mappers at:
// https://lvcharts.com/docs/{{ platform }}/{{ version }}/Overview.Mappers
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<UserControl
x:Class="UnoWinUISample.Axes.Crosshairs.View"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.WinUI"
xmlns:vms="using:ViewModelsSamples.Axes.Crosshairs"
mc:Ignorable="d">

<UserControl.DataContext>
<vms:ViewModel/>
</UserControl.DataContext>
<Grid>
<lvc:CartesianChart
Series="{Binding Series}"
XAxes="{Binding XAxes}"
YAxes="{Binding YAxes}">
</lvc:CartesianChart>
</Grid>

</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Microsoft.UI.Xaml.Controls;

namespace UnoWinUISample.Axes.Crosshairs;

public sealed partial class View : UserControl
{
public View()
{
InitializeComponent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
</UserControl.DataContext>
<lvc:PieChart
Series="{Binding Series}"
Title="{Binding Title}"
LegendPosition="Right">
Title="{Binding Title}">
</lvc:PieChart>
</UserControl>
Loading

0 comments on commit d7c8ee3

Please sign in to comment.