Skip to content

Commit

Permalink
test...
Browse files Browse the repository at this point in the history
  • Loading branch information
beto-rodriguez committed Jul 20, 2023
1 parent f0827ae commit c0932af
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 148 deletions.
2 changes: 1 addition & 1 deletion samples/MauiSample/Lines/Basic/View.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<ContentPage.BindingContext>
<vms:ViewModel/>
</ContentPage.BindingContext>
<lvc:CartesianChart Series="{Binding Series}" Title="{Binding Title}" />
<lvc:CartesianChart Series="{Binding Series}" Title="{Binding Title}" TooltipTextSize="100"/>
</ContentPage>
218 changes: 109 additions & 109 deletions samples/ViewModelsSamples/Index.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,116 +4,116 @@ public static class Index
{
public static string[] Samples =
{
"Design/LinearGradients",
"Design/RadialGradients",
//"Design/LinearGradients",
//"Design/RadialGradients",

"Lines/Basic",
"Lines/AutoUpdate",
"Lines/Straight",
"Lines/Properties",
"Lines/Area",
"Lines/Custom",
"Lines/Padding",
"Lines/XY",
"Lines/Zoom",

"StepLines/Basic",
"StepLines/AutoUpdate",
"StepLines/Properties",
"StepLines/Area",
"StepLines/Custom",
"StepLines/Zoom",

"StackedArea/Basic",
"StackedArea/StepArea",

"Bars/Basic",
"Bars/AutoUpdate",
"Bars/Custom",
"Bars/WithBackground",
"Bars/Spacing",
"Bars/DelayedAnimation",
"Bars/Race",
"Bars/RowsWithLabels",
"Bars/Layered",

"StackedBars/Basic",
"StackedBars/Groups",

"Pies/Basic",
"Pies/AutoUpdate",
"Pies/Processing",
"Pies/Doughnut",
"Pies/Pushout",
"Pies/Custom",
"Pies/NightingaleRose",
"Pies/Gauges",
//"Pies/Gauge",
"Pies/Gauge1",
"Pies/Gauge2",
"Pies/Gauge3",
"Pies/Gauge4",
"Pies/Gauge5",

"Scatter/Basic",
"Scatter/Bubbles",
"Scatter/AutoUpdate",
"Scatter/Custom",

"Financial/BasicCandlesticks",

"Heat/Basic",

"Polar/Basic",
"Polar/RadialArea",
"Polar/Coordinates",

"Axes/LabelsFormat",
"Axes/LabelsFormat2",
"Axes/NamedLabels",
"Axes/LabelsRotation",
"Axes/Multiple",
"Axes/Shared",
"Axes/ColorsAndPosition",
"Axes/Crosshairs",
"Axes/CustomSeparatorsInterval",
"Axes/DateTimeScaled",
"Axes/TimeSpanScaled",
"Axes/Logarithmic",
"Axes/Style",
"Axes/Paging",

"Events/AddPointOnClick",
"Events/Cartesian",
"Events/Pie",
"Events/Polar",

"General/Scrollable",
"General/Sections",
"General/Sections2",
"General/ConditionalDraw",
"General/VisualElements",
"General/ChartToImage",
"General/Tooltips",
"General/Legends",
"General/Animations",
"General/Visibility",
"General/TemplatedTooltips",
"General/TemplatedLegends",
"General/UserDefinedTypes",
"General/NullPoints",
"General/MultiThreading",
"General/MultiThreading2",

"VisualTest/TwoChartsOneSeries",
"VisualTest/ReattachVisual",
"VisualTest/DataTemplate",
"VisualTest/Tabs",

"Test/ChangeSeriesInstance",
"Test/Dispose",
"Test/MotionCanvasDispose",

"Maps/World"
//"Lines/AutoUpdate",
//"Lines/Straight",
//"Lines/Properties",
//"Lines/Area",
//"Lines/Custom",
//"Lines/Padding",
//"Lines/XY",
//"Lines/Zoom",

//"StepLines/Basic",
//"StepLines/AutoUpdate",
//"StepLines/Properties",
//"StepLines/Area",
//"StepLines/Custom",
//"StepLines/Zoom",

//"StackedArea/Basic",
//"StackedArea/StepArea",

//"Bars/Basic",
//"Bars/AutoUpdate",
//"Bars/Custom",
//"Bars/WithBackground",
//"Bars/Spacing",
//"Bars/DelayedAnimation",
//"Bars/Race",
//"Bars/RowsWithLabels",
//"Bars/Layered",

//"StackedBars/Basic",
//"StackedBars/Groups",

//"Pies/Basic",
//"Pies/AutoUpdate",
//"Pies/Processing",
//"Pies/Doughnut",
//"Pies/Pushout",
//"Pies/Custom",
//"Pies/NightingaleRose",
//"Pies/Gauges",
////"Pies/Gauge",
//"Pies/Gauge1",
//"Pies/Gauge2",
//"Pies/Gauge3",
//"Pies/Gauge4",
//"Pies/Gauge5",

//"Scatter/Basic",
//"Scatter/Bubbles",
//"Scatter/AutoUpdate",
//"Scatter/Custom",

//"Financial/BasicCandlesticks",

//"Heat/Basic",

//"Polar/Basic",
//"Polar/RadialArea",
//"Polar/Coordinates",

//"Axes/LabelsFormat",
//"Axes/LabelsFormat2",
//"Axes/NamedLabels",
//"Axes/LabelsRotation",
//"Axes/Multiple",
//"Axes/Shared",
//"Axes/ColorsAndPosition",
//"Axes/Crosshairs",
//"Axes/CustomSeparatorsInterval",
//"Axes/DateTimeScaled",
//"Axes/TimeSpanScaled",
//"Axes/Logarithmic",
//"Axes/Style",
//"Axes/Paging",

//"Events/AddPointOnClick",
//"Events/Cartesian",
//"Events/Pie",
//"Events/Polar",

//"General/Scrollable",
//"General/Sections",
//"General/Sections2",
//"General/ConditionalDraw",
//"General/VisualElements",
//"General/ChartToImage",
//"General/Tooltips",
//"General/Legends",
//"General/Animations",
//"General/Visibility",
//"General/TemplatedTooltips",
//"General/TemplatedLegends",
//"General/UserDefinedTypes",
//"General/NullPoints",
//"General/MultiThreading",
//"General/MultiThreading2",

//"VisualTest/TwoChartsOneSeries",
//"VisualTest/ReattachVisual",
//"VisualTest/DataTemplate",
//"VisualTest/Tabs",

//"Test/ChangeSeriesInstance",
//"Test/Dispose",
//"Test/MotionCanvasDispose",

//"Maps/World"
};
}
76 changes: 38 additions & 38 deletions src/skiasharp/LiveChartsCore.SkiaSharp/SKCharts/SKDefaultTooltip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace LiveChartsCore.SkiaSharpView.SKCharts;

public class SKDefaultTooltip : IChartTooltip<SkiaSharpDrawingContext>
{
internal StackPanel<PopUpGeometry, SkiaSharpDrawingContext>? _panel;
internal StackPanel<RectangleGeometry, SkiaSharpDrawingContext>? _panel;
private static readonly int s_zIndex = 10050;
private IPaint<SkiaSharpDrawingContext>? _backgroundPaint;

Expand All @@ -46,8 +46,8 @@ public class SKDefaultTooltip : IChartTooltip<SkiaSharpDrawingContext>
/// </summary>
public SKDefaultTooltip()
{
FontPaint = new SolidColorPaint(new SKColor(28, 49, 58));
BackgroundPaint = new SolidColorPaint(new SKColor(245, 245, 245, 230))
FontPaint = new SolidColorPaint(new SKColor(250, 250, 250));
BackgroundPaint = new SolidColorPaint(new SKColor(45, 45, 45, 230))
{
ImageFilter = new DropShadow(0, 0, 4, 4, new SKColor(0, 0, 0, 70))
};
Expand Down Expand Up @@ -84,21 +84,21 @@ public void Show(IEnumerable<ChartPoint> foundPoints, Chart<SkiaSharpDrawingCont
{
const int wedge = 13;

if (chart.View.LegendTextSize is not null) TextSize = chart.View.LegendTextSize.Value;
if (chart.View.TooltipTextSize is not null) TextSize = chart.View.TooltipTextSize.Value;
if (chart.View.TooltipBackgroundPaint is not null) BackgroundPaint = chart.View.TooltipBackgroundPaint;
if (chart.View.TooltipTextPaint is not null) FontPaint = chart.View.TooltipTextPaint;

if (_panel is null)
{
_panel = new StackPanel<PopUpGeometry, SkiaSharpDrawingContext>
_panel = new StackPanel<RectangleGeometry, SkiaSharpDrawingContext>
{
Orientation = ContainerOrientation.Vertical,
HorizontalAlignment = Align.Middle,
VerticalAlignment = Align.Middle,
BackgroundPaint = BackgroundPaint
};

_panel.BackgroundGeometry.Wedge = wedge;
//_panel.BackgroundGeometry.Wedge = wedge;

_panel
.Animate(
Expand Down Expand Up @@ -152,27 +152,27 @@ public void Show(IEnumerable<ChartPoint> foundPoints, Chart<SkiaSharpDrawingCont

if (content != LiveCharts.IgnoreToolTipLabel)
{
tableLayout.AddChild(series.GetMiniaturesSketch().AsDrawnControl(), i, 0);
//tableLayout.AddChild(series.GetMiniaturesSketch().AsDrawnControl(), i, 0);
tableLayout.AddChild(
new LabelVisual
{
Text = point.Context.Series.Name ?? string.Empty,
Text = "THIS IS JUST A TEST", // point.Context.Series.Name ?? string.Empty,
Paint = FontPaint,
TextSize = TextSize,
Padding = new Padding(8, 0, 0, 0),
//Padding = new Padding(8, 0, 0, 0),
VerticalAlignment = Align.Start,
HorizontalAlignment = Align.Start
}, i, 1, horizontalAlign: Align.Start);
tableLayout.AddChild(
new LabelVisual
{
Text = content,
Paint = FontPaint,
TextSize = TextSize,
Padding = new Padding(16, 0, 0, 0),
VerticalAlignment = Align.Start,
HorizontalAlignment = Align.Start
}, i, 2, horizontalAlign: Align.End);
}, i, 0, horizontalAlign: Align.Start);
//tableLayout.AddChild(
// new LabelVisual
// {
// Text = content,
// Paint = FontPaint,
// TextSize = TextSize,
// //Padding = new Padding(16, 0, 0, 0),
// VerticalAlignment = Align.Start,
// HorizontalAlignment = Align.Start
// }, i, 2, horizontalAlign: Align.End);

i++;
}
Expand All @@ -181,24 +181,24 @@ public void Show(IEnumerable<ChartPoint> foundPoints, Chart<SkiaSharpDrawingCont
_panel.Children.Add(tableLayout);

var size = _panel.Measure(chart);
_ = foundPoints.GetTooltipLocation(size, chart);
_panel.BackgroundGeometry.Placement = chart.AutoToolTipsInfo.ToolTipPlacement;

switch (chart.AutoToolTipsInfo.ToolTipPlacement)
{
case Measure.PopUpPlacement.Top:
_panel.Padding = new Padding(12, 8, 12, 8 + wedge); break;
case Measure.PopUpPlacement.Bottom:
_panel.Padding = new Padding(12, 8 + wedge, 12, 8); break;
case Measure.PopUpPlacement.Left:
_panel.Padding = new Padding(12, 8, 12 + wedge, 8); break;
case Measure.PopUpPlacement.Right:
_panel.Padding = new Padding(12 + wedge, 8, 12, 8); break;
default: break;
}

// the size changed... we need to do the math again
size = _panel.Measure(chart);
//_ = foundPoints.GetTooltipLocation(size, chart);
//_panel.BackgroundGeometry.Placement = chart.AutoToolTipsInfo.ToolTipPlacement;

//switch (chart.AutoToolTipsInfo.ToolTipPlacement)
//{
// case Measure.PopUpPlacement.Top:
// _panel.Padding = new Padding(12, 8, 12, 8 + wedge); break;
// case Measure.PopUpPlacement.Bottom:
// _panel.Padding = new Padding(12, 8 + wedge, 12, 8); break;
// case Measure.PopUpPlacement.Left:
// _panel.Padding = new Padding(12, 8, 12 + wedge, 8); break;
// case Measure.PopUpPlacement.Right:
// _panel.Padding = new Padding(12 + wedge, 8, 12, 8); break;
// default: break;
//}

//// the size changed... we need to do the math again
//size = _panel.Measure(chart);
var location = foundPoints.GetTooltipLocation(size, chart);

_panel.X = location.X;
Expand Down

0 comments on commit c0932af

Please sign in to comment.