code-artist / mschartextension Goto Github PK
View Code? Open in Web Editor NEWWindows Forms MSChart Extensions Method
License: MIT License
Windows Forms MSChart Extensions Method
License: MIT License
Visual Studio 2012, Build/"Run Code Analysis on Solution" yields multiple warnings of the above mentioned kind for WindowMessagesNativeMethods.cs (Line 13). Not sure how to correct that. There might be some relevant information on http://www.pinvoke.net/default.aspx/user32/SendMessage.html
If a chart has a number of series in it, it's inconvenient to constantly r-click and disable/enable the series of interest. I propose keeping the menu open when any of the series items are clicked.
I took a look and tried a few things in the code but, due to the way the metadata (e.g. the chart's series) is being associated with the menu items, it isn't as simple as setting AutoClose
to false or attaching to the Closing
event and canceling it. These both serve to keep the menu open, but the checkbox values don't change and, on the second click of any item, a number of null reference exceptions happen.
Here's some useful code that I started from: http://stackoverflow.com/questions/3429487/contextmenu-will-not-stay-open-c-sharp-net-4-0-client-profile-winforms
As a dev
I want to get the Annotation
I've just added using the DrawXXX
methods
So that I can store it for later removal, use it in a lookup, change its properties, etc
Example:
var xLoc = 1.0;
Annotation justAdded = chart.DrawVerticalLine(xLoc, Color.Blue);
justAdded.Visible = false;
vertLineAnnotations.Add(justAdded);
lineLookup.Add(xLoc, justAdded);
...
It makes sense to constrain the extent of selection to within the chart when zooming, but when panning it's just an inconvenience for the user.
As a user,
When in Pan mode after having Zoomed in
I want to click anywhere on the chart and drag to anywhere on my screen
And see the chart panning
So that I don't have to click and drag within the chart a bunch of times
I'm still working on some of the other issues, but one feature has become a priority and that is to be able to zoom only in X.
As a user,
I want to click and drag anywhere on the chart
And see a selection box which fills the height of the chart and goes from the left side of where I clicked to the right side of where the mouse is moving (or vice-versa)
And when I release the mouse the chart is zoomed to that range
So that I can see my data at higher resolution
As a dev,
I want to know when the user has changed the window of data viewed (zoomed)
And know what the new extents (top, left, bottom, right) are in units matching those of the data
So that I can perform statistics on only the visible data
To address these two stories, I propose:
How does that sound? In regards to the current method of passing in callbacks to the constructor, is that being done because there isn't a way to extend the Chart object with new events, or was it just a preference for callbacks instead of events? I'm use to using events, but I'd like to know what considerations were made when you decided to use callbacks instead.
Thanks!
Pat
I have attached the plot on a form and during a minimizing in the a cursor is present on the plot the application crash.
The error is the followng:
at System.Windows.Forms.DataVisualization.Charting.Axis.PositionToValue(Double position, Boolean validateInput)
at System.Windows.Forms.DataVisualization.Charting.Axis.PixelPositionToValue(Double position)
at System.Windows.Forms.DataVisualization.Charting.MSChartExtension.CheckAndUpdateTextAnnotationLocation(Chart chart, TextAnnotation textAnn, Double xStart, Double yStart)
at System.Windows.Forms.DataVisualization.Charting.MSChartExtension.UpdateCursorLabelPosition(Chart sender)
at System.Windows.Forms.DataVisualization.Charting.MSChartExtension.ChartControl_Resized(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I see that a separate branch has been created to add zooming with the mouse wheel. I for one would like to see that functionality completed.
Hi,
Can MSChartExtension support displaying data in real-time? Can we feed 1000 data points for every 100ms?
A max of 1000 data points in the chart can be display at at time.
Can it support displaying more than 1 series of data?
Thanks
Along the lines of some of the work done with ZoomChanged, wherein the client's callback receives the extents of the visible data, I was thinking that a callback once the user has stopped panning would be in order.
A scenario would be that the client wants to update statistics (say mean, standard deviation, min/max, etc) on the visible data. Currently, she or he can use the ZoomChanged callback to receive this information any time the chart is zoomed. But if the user pans, we have no mechanism in place (unless I'm missing something) to ensure that the client is notified that the visible extents of the chart have changed. Now, one option is for the client to just wire up a button saying "Recalculate Statistics," but I think an event or callback would result in a more user-friendly interface.
Lastly, in order to facilitate this and future changes, it might be wise to return a ChartController
object from the EnableZoomAndPanControls()
method. Then we could use that object to subscribe to events, enable/disable context menu items, and maybe more. I haven't thought it through too much, but I feel that this method would make it easier to introduce new features without breaking backwards-compatibility (and without adding too many parameters to the extension method).
Anyway, just some ideas to discuss, so please leave feedback.
Thanks,
Pat
I've already implemented the code, but I figured that I would start a discussion. Maybe there's a good reason why selection should only be one point and I'm not thinking of it.
The way I implemented it, the callback is made on the MouseUp event rather than MouseDown (the previous method). This way, the callback (whose signature now just sends a RectangleF) is called only once with the complete selection area information. This may break existing code that relied on SelectionChanged being called on MouseDown, but I doubt it.
To supplement this new selection style, I wrote a method that returns the DataPoints within the selected area, which is clearly a useful thing.
My .NET 4.7.2 C# program crashes when I select "Clear Cursors" with v3.2.0. I tried version 2.1.0 and that crashes when you drag a rectangle to zoom in. It's fine with v1.4.1.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.