Skip to content

Commit

Permalink
Merge pull request #1070 from beto-rodriguez/dev
Browse files Browse the repository at this point in the history
beta-801
  • Loading branch information
beto-rodriguez committed Jun 17, 2023
2 parents c49d9a6 + d5bf738 commit 60958aa
Show file tree
Hide file tree
Showing 44 changed files with 737 additions and 650 deletions.
6 changes: 3 additions & 3 deletions build/pack.singed.ps1
@@ -1,7 +1,7 @@
& $PSScriptRoot\pack.ps1 Release
# & $PSScriptRoot\pack.ps1 Release

& dotnet nuget push **/*.nupkg --api-key oy2o6gainuded3gc42sq2gddywqhhhiu3cxtns4lokf5hu --source https://api.nuget.org/v3/index.json --skip-duplicate
& dotnet nuget push **/*.nupkg --api-key oy2dbuhvjryhbuvo4spafzblwxojzwpulhoi3rvxiuag54 --source https://api.nuget.org/v3/index.json --skip-duplicate

## this should only be ran once?
## dotnet nuget add source --username beto-rodriguez --password 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 --store-password-in-clear-text --name github "https://nuget.pkg.github.com/beto-rodriguez/index.json"
& dotnet nuget push **/*.nupkg --api-key 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 --source "github" --skip-duplicate
& dotnet nuget push **/*.nupkg --api-key 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 --source "github" --skip-duplicate
3 changes: 2 additions & 1 deletion samples/AvaloniaSample/General/VisualElements/View.axaml
Expand Up @@ -9,7 +9,8 @@
<Grid>
<lvc:CartesianChart
Series="{Binding Series}"
VisualElements="{Binding VisualElements}">
VisualElements="{Binding VisualElements}"
ZoomMode="X">
</lvc:CartesianChart>
</Grid>
</UserControl>
3 changes: 2 additions & 1 deletion samples/BlazorSample/Pages/General/VisualElements.razor
Expand Up @@ -4,7 +4,8 @@

<CartesianChart
Series="ViewModel.Series"
VisualElements="ViewModel.VisualElements">
VisualElements="ViewModel.VisualElements"
ZoomMode="LiveChartsCore.Measure.ZoomAndPanMode.X">
</CartesianChart>

@code {
Expand Down
1 change: 1 addition & 0 deletions samples/EtoFormsSample/General/VisualElements/View.cs
Expand Up @@ -14,6 +14,7 @@ public View()
{
Series = viewModel.Series,
VisualElements = viewModel.VisualElements,
ZoomMode = LiveChartsCore.Measure.ZoomAndPanMode.X
};

Content = cartesianChart;
Expand Down
5 changes: 3 additions & 2 deletions samples/MauiSample/General/VisualElements/View.xaml
Expand Up @@ -11,8 +11,9 @@
<ContentPage.Content>
<Grid>
<lvc:CartesianChart
Series="{Binding Series}"
VisualElements="{Binding VisualElements}">
Series="{Binding Series}"
VisualElements="{Binding VisualElements}"
ZoomMode="X">
</lvc:CartesianChart>
</Grid>
</ContentPage.Content>
Expand Down
3 changes: 2 additions & 1 deletion samples/UWPSample/General/VisualElements/View.xaml
Expand Up @@ -15,7 +15,8 @@
<Grid>
<lvc:CartesianChart
Series="{Binding Series}"
VisualElements="{Binding VisualElements}">
VisualElements="{Binding VisualElements}"
ZoomMode="X">
</lvc:CartesianChart>
</Grid>

Expand Down
Expand Up @@ -15,7 +15,8 @@
<Grid>
<lvc:CartesianChart
Series="{Binding Series}"
VisualElements="{Binding VisualElements}">
VisualElements="{Binding VisualElements}"
ZoomMode="X">
</lvc:CartesianChart>
</Grid>

Expand Down
25 changes: 0 additions & 25 deletions samples/ViewModelsSamples/General/VisualElements/MyGeometry.cs

This file was deleted.

37 changes: 21 additions & 16 deletions samples/ViewModelsSamples/General/VisualElements/ViewModel.cs
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using CommunityToolkit.Mvvm.ComponentModel;
using LiveChartsCore;
using LiveChartsCore.Defaults;
using LiveChartsCore.Drawing;
using LiveChartsCore.Kernel;
using LiveChartsCore.Measure;
Expand All @@ -27,8 +25,11 @@ public partial class ViewModel : ObservableObject
Width = 4,
Height = 2,
SizeUnit = MeasureUnit.ChartValues,
Fill = new SolidColorPaint(new SKColor(239, 83, 80, 50)) { ZIndex = 10 },
Fill = new SolidColorPaint(new SKColor(239, 83, 80, 220)) { ZIndex = 10 },
Stroke = new SolidColorPaint(new SKColor(239, 83, 80)) { ZIndex = 10, StrokeThickness = 1.5f },
Label = "Hello!",
LabelPaint = new SolidColorPaint(new SKColor(220, 220, 220)) { ZIndex = 11 },
LabelSize = 12
},
new GeometryVisual<OvalGeometry>
{
Expand All @@ -41,17 +42,6 @@ public partial class ViewModel : ObservableObject
Fill = new SolidColorPaint(new SKColor(100, 221, 23, 50)) { ZIndex = - 10 },
Stroke = new SolidColorPaint(new SKColor(100, 221, 23)) { ZIndex = -10, StrokeThickness = 1.5f },
},
new GeometryVisual<MyGeometry>
{
X = 18,
Y = 6,
LocationUnit = MeasureUnit.ChartValues,
Width = 100,
Height = 100,
SizeUnit = MeasureUnit.Pixels,
Fill = new SolidColorPaint(new SKColor(251, 192, 45, 50)) { ZIndex = 10 },
Stroke = new SolidColorPaint(new SKColor(251, 192, 45)) { ZIndex = 10, StrokeThickness = 1.5f },
},
new LabelVisual
{
Text = "What happened here?",
Expand All @@ -63,7 +53,22 @@ public partial class ViewModel : ObservableObject
Padding = new Padding(12),
LocationUnit = MeasureUnit.ChartValues,
Translate = new LvcPoint(0, -35)
}
},
new SVGVisual
{
Path = SVGPoints.Star,
X = 80,
Y = 80,
LocationUnit = MeasureUnit.Pixels,
Width = 100,
Height = 100,
SizeUnit = MeasureUnit.Pixels,
Fill = new SolidColorPaint(new SKColor(251, 192, 45, 50)) { ZIndex = 10 },
Stroke = new SolidColorPaint(new SKColor(251, 192, 45)) { ZIndex = 10, StrokeThickness = 1.5f },
Label = "This one is fixed",
LabelPaint = new SolidColorPaint(SKColors.Black) { ZIndex = 11 },
LabelSize = 10
},
};

public ISeries[] Series { get; set; } =
Expand Down
3 changes: 2 additions & 1 deletion samples/WPFSample/General/VisualElements/View.xaml
Expand Up @@ -9,7 +9,8 @@
<Grid>
<lvc:CartesianChart
Series="{Binding Series}"
VisualElements="{Binding VisualElements}">
VisualElements="{Binding VisualElements}"
ZoomMode="X">
</lvc:CartesianChart>
</Grid>
</UserControl>
2 changes: 1 addition & 1 deletion samples/WinFormsSample/General/VisualElements/View.cs
Expand Up @@ -20,7 +20,7 @@ public View()
{
Series = viewModel.Series,
VisualElements = viewModel.VisualElements,
TooltipPosition = LiveChartsCore.Measure.TooltipPosition.Hidden,
ZoomMode = LiveChartsCore.Measure.ZoomAndPanMode.X,

// out of livecharts properties...
Location = new System.Drawing.Point(0, 0),
Expand Down
Expand Up @@ -14,7 +14,8 @@
<Grid>
<lvc:CartesianChart
Series="{Binding Series}"
VisualElements="{Binding VisualElements}">
VisualElements="{Binding VisualElements}"
ZoomMode="X">
</lvc:CartesianChart>
</Grid>
</UserControl>
Expand Up @@ -10,7 +10,8 @@
<Grid>
<lvc:CartesianChart
Series="{Binding Series}"
VisualElements="{Binding VisualElements}">
VisualElements="{Binding VisualElements}"
ZoomMode="X">
</lvc:CartesianChart>
</Grid>
</ContentPage>
3 changes: 1 addition & 2 deletions src/LiveChartsCore/AssemblyInfo.cs
Expand Up @@ -51,6 +51,5 @@
[assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.Blazor")]
[assembly: InternalsVisibleTo("LiveChartsCore.SkiaSharpView.Maui")]
[assembly: InternalsVisibleTo("LiveChartsCore.BackersPackage")]
#endif

[assembly: InternalsVisibleTo("LiveChartsCore.UnitTesting")]
#endif
2 changes: 1 addition & 1 deletion src/LiveChartsCore/LiveChartsCore.csproj
Expand Up @@ -17,7 +17,7 @@

<AssemblyName>LiveChartsCore</AssemblyName>
<RootNamespace>LiveChartsCore</RootNamespace>
<Version>2.0.0-beta.800</Version>
<Version>2.0.0-beta.801</Version>
<PackageIcon>icon.png</PackageIcon>
<Description>Simple, flexible, interactive and powerful data visualization for .Net, this is the core package probably you need another package also unless you are building your own backed.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
20 changes: 10 additions & 10 deletions src/LiveChartsCore/Section.cs
Expand Up @@ -186,16 +186,6 @@ public abstract class Section<TSizedGeometry, TLabelGeometry, TDrawingContext> :
private string _label = string.Empty;
private float _labelSize = 12;

/// <summary>
/// Gets or sets the label, a string to be displayed within the section.
/// </summary>
public string Label { get => _label; set => SetProperty(ref _label, value); }

/// <summary>
/// Gets or sets the label size.
/// </summary>
public double LabelSize { get => _labelSize; set => SetProperty(ref _labelSize, (float)value); }

/// <summary>
/// The fill sized geometry
/// </summary>
Expand All @@ -211,6 +201,16 @@ public abstract class Section<TSizedGeometry, TLabelGeometry, TDrawingContext> :
/// </summary>
protected internal TLabelGeometry? _labelGeometry;

/// <summary>
/// Gets or sets the label, a string to be displayed within the section.
/// </summary>
public string Label { get => _label; set => SetProperty(ref _label, value); }

/// <summary>
/// Gets or sets the label size.
/// </summary>
public double LabelSize { get => _labelSize; set => SetProperty(ref _labelSize, (float)value); }

/// <summary>
/// Measures the specified chart.
/// </summary>
Expand Down
91 changes: 91 additions & 0 deletions src/LiveChartsCore/VisualElements/BaseGeometryVisual.cs
@@ -0,0 +1,91 @@
// 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.Drawing;
using LiveChartsCore.Kernel;
using LiveChartsCore.Measure;

namespace LiveChartsCore.VisualElements;

/// <summary>
/// Defines a visual element that has stroke and fill, it can also be scaled in
/// <see cref="MeasureUnit.Pixels"/> or <see cref="MeasureUnit.ChartValues"/>.
/// </summary>
/// <typeparam name="TDrawingContext">The type of the drawing context,</typeparam>
public abstract class BaseGeometryVisual<TDrawingContext> : VisualElement<TDrawingContext>
where TDrawingContext : DrawingContext
{
private double _width;
private double _height;
private IPaint<TDrawingContext>? _fill;
private IPaint<TDrawingContext>? _stroke;
private MeasureUnit _sizeUnit = MeasureUnit.Pixels;

/// <summary>
/// Gets or sets the height of the rectangle [in Pixels or ChartValues, see <see cref="SizeUnit"/>].
/// </summary>
public double Width { get => _width; set => SetProperty(ref _width, value); }

/// <summary>
/// Gets or sets the width of the rectangle [in Pixels or ChartValues, see <see cref="SizeUnit"/>].
/// </summary>
public double Height { get => _height; set => SetProperty(ref _height, value); }

/// <summary>
/// Gets or sets the unit of the <see cref="Height"/> and <see cref="Width"/> properties.
/// </summary>
public MeasureUnit SizeUnit { get => _sizeUnit; set => SetProperty(ref _sizeUnit, value); }
/// <summary>
/// Gets or sets the fill paint.
/// </summary>
public IPaint<TDrawingContext>? Fill
{
get => _fill;
set => SetPaintProperty(ref _fill, value);
}

/// <summary>
/// Gets or sets the stroke paint.
/// </summary>
public IPaint<TDrawingContext>? Stroke
{
get => _stroke;
set => SetPaintProperty(ref _stroke, value, true);
}

/// <inheritdoc cref="ChartElement{TDrawingContext}.GetPaintTasks"/>
internal override IPaint<TDrawingContext>?[] GetPaintTasks()
{
return new[] { _fill, _stroke };
}

/// <summary>
/// Called when [paint changed].
/// </summary>
/// <param name="propertyName">Name of the property.</param>
/// <returns></returns>
protected override void OnPaintChanged(string? propertyName)
{
base.OnPaintChanged(propertyName);
OnPropertyChanged(propertyName);
}
}

0 comments on commit 60958aa

Please sign in to comment.