Comments (1)
Currently I am partially working around this by setting MinLimit = -(items.Count()/16.0), MaxLimit = items.Count()
on the X Axis. This doesn't actually fix anything, but it at least sets the limits to be roughly similar to the post-pan limits by default, so that the movement on click isn't as jarring.
The secondary issue is that ChartPointPointerDown executes before it can even be determined whether the user is dragging or clicking, and there is no ChartPointPressed or ChartPointPointerUp or ChartPointClicked.
For that, I'm making use of everything I have at my disposal: ChartPointPointerDown to get the ChartPoint, and MouseDown and MouseUp to determine whether we're clicking or dragging.
object? mouseDownObject;
Point? mouseDownPos;
ChartPoint? chartPoint;
private void CartesianChart_MouseDown(object sender, MouseButtonEventArgs e)
{
// Store the clicked object and mouse position for comparison on MouseUp
mouseDownObject = sender;
mouseDownPos = e.GetPosition(this);
}
private void CartesianChart_ChartPointPointerDown(IChartView chart, ChartPoint point)
{
// Store the clicked point for use on MouseUp
chartPoint = point;
}
private void CartesianChart_MouseUp(object sender, MouseButtonEventArgs e)
{
if (DataContext is not MyViewModel vm)
return;
// Ensure we're still acting on the same object
if (sender != mouseDownObject)
{
mouseDownObject = null;
return;
}
// If the new position isn't the same as the old one, we're dragging, not clicking
Point pos = e.GetPosition(this);
if (pos != mouseDownPos)
return;
// Get the series and point model and execute the appropriate point activation function for that series
var series = (ColumnSeries<(string Key, double Value)>)((CartesianChart)sender).Series.First();
var pointModel = ((string Key, double Value))chartPoint.Context.DataSource;
vm.ActivatePoint(series, pointModel);
}
from livecharts2.
Related Issues (20)
- Build Failure: Missing 'icon.png' in LiveChartsCore.SkiaSharpView.WinUI during WinUI Project Packaging
- docs bug
- Invalid geo map country code causes drawing bug
- ScalesXAt, ScalesYAt should reference directly to XAxis,Yaxis instead of index
- Empty collection does not let the plot become invisible HOT 2
- Not Working with latest MAUI mobile app.
- The legend does not reflect my Stroke color
- PIeChart Documentation Out of Date HOT 2
- HeatMap color interpolation not correct
- Bad rendering on MacOS/Catalyst with a Uno Platform project
- 3d hardware acceleration
- FontFamily="{StaticResource myFont}" not work
- How to Draw Arrows, Lines, and Rectangles on CartesianChart with CandlesticksSeries<FinancialPoint>?
- Building from CSV
- Charts do not scale properly when moving to extended display with different scale on Mac (MAUI)
- Doughnut Chart Center Label
- How to Display Chinese in Save as Image? HOT 2
- Custom Geometry binding to the point ,for control the rotation of geometry
- How to hide this tick mark HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from livecharts2.