Quantcast
Channel: oxyplot Discussions Rss Feed
Viewing all 1267 articles
Browse latest View live

New Post: Point selection on Line series?

$
0
0
Hi,

First of all, thank you very much for this great chart library.
I'm having a problem while attempting to change the color of the selected marker in a line series. Is this possible at all, or it is a not-supported feature?

I've tried to modify the "LineSeries and PlotModel MouseDown event" example, simply adding the following lines
        model.SelectionColor = OxyColors.Red;
        s1.SelectionMode = SelectionMode.Single;
        s1.ItemsSource = s1.Points;
and inside the MouseDown event handler
                // Check if we are near a point
                if ((nearestPoint - e.Position).Length < 10)
                {
                    // Start editing this point
                    indexOfPointToMove = indexOfNearestPoint;
                    s1.SelectItem(indexOfPointToMove);
                }
This doesn't seem to work. Is there something that I'm missing?

Last thing, why do we have to change the color at model level? Isn't more flexible doing it a series level? That is we could also have more control on the stroke of the selected item.

Thanks,
Fabio

New Post: Point selection on Line series?

$
0
0
After tracing it back through the source, it does seem to flag the item properly (all the way back in Selection.cs). Are you refreshing the plot after you select the item? (InvalidatePlot(false) on the view or model). The mouse event will change the flag but it won't actually display anything on it's own unless you tell the view to update manually.

Also imo at least selection colour should be global to the model itself, not series. I can't really think of a reason you'd want multiple different selection colours unless you're selecting different items for different actions.

New Post: Point selection on Line series?

$
0
0
Yes, the model get invalidated (the lines of code I've added are from on of the examples).
If you see that the flag set properly. then, or it is ignored, or the color is overwritten when the line series get rendered, I imagine.

The reason was for aesthetics, as I might have 2 or more series on the same plot, and I might want to highlight each marker based on the original marker color, or with different colors for quick distinguish with a quick look. (I'm assuming here that you can have multiple items selected on the same plot from different series)

Anyway I solved it creating a scattered series that "clones" some information from the selected marker's series and paint a scattered item on top of it.

Thank you for the help.

New Post: Point selection on Line series?

$
0
0
Well when it's the Selection object itself then it just has a boolean flag, but when it's a point in it, the Selection object has an array of bools that it flags with the index given to it. (Source Link).

That sounds more like a use for highlighting, not selection, although I do agree, I think highlighting should be drawn around (probably harder than it sounds or based on the original colour). It does look a bit weird in the Toolbar example I put together when you change the colour of an annotation and it just remains shiny yellow, would be nice to have it based on the colour it is, as you mention.

New Post: How to copy a plot in WindowsForms ?

$
0
0
Here's how I'm handling it:
PlotController.BindKeyDown(OxyKey.C,
                           OxyModifierKeys.Control,
                           new DelegatePlotCommand<OxyKeyEventArgs>(
                               CopyChart_OnKeyDown));
                               
privatevoid CopyChart_OnKeyDown(
    IPlotView view,
    IController controller,
    OxyKeyEventArgs args)
{
    var chartBitmap = new Bitmap(uiPlotView.Width, uiPlotView.Height);
    uiPlotView.DrawToBitmap(chartBitmap,
                            new Rectangle(0, 0, uiPlotView.Width, uiPlotView.Height));
    Clipboard.SetImage(chartBitmap);
}
I actually based this on some code that used to be in the PlotCommands, not sure why it was taken out.

New Post: How to copy a plot in WindowsForms ?

$
0
0
Thanks to you. you answer is right and my problem has solved.

New Post: How to copy a plot in WindowsForms ?

$
0
0
Slxe wrote:
Here's how I'm handling it:
PlotController.BindKeyDown(OxyKey.C,
                           OxyModifierKeys.Control,
                           new DelegatePlotCommand<OxyKeyEventArgs>(
                               CopyChart_OnKeyDown));
                               
privatevoid CopyChart_OnKeyDown(
    IPlotView view,
    IController controller,
    OxyKeyEventArgs args)
{
    var chartBitmap = new Bitmap(uiPlotView.Width, uiPlotView.Height);
    uiPlotView.DrawToBitmap(chartBitmap,
                            new Rectangle(0, 0, uiPlotView.Width, uiPlotView.Height));
    Clipboard.SetImage(chartBitmap);
}
I actually based this on some code that used to be in the PlotCommands, not sure why it was taken out.
Thanks to you. you answer is right and my problem has solved.

New Post: LegendSymbolZoom property is possibly required when rendering ScatterSeries with a tiny MarkerSize

$
0
0
As stated in this subject‘s title, there's lots of complains that symbols in legend are too hard to be recognized if MarkerSize is defined too small. By providing LegendSymbolZoom property in PlotModel class, we can specify a suitable displaying size for symbols of the legend.

New Post: Using DateTimeIntervalType.Manual

$
0
0
I want to be able to specify my DateTime labels specific to my date, so it seems the DateTypeIntervalType Manual is perfect for that. However, I can't find documentation as to how to use it.

My graphs display specific date ranges based upon user selection of 1 day, 3 day, 7 day, or 1 month. When 1 day is selected, I want ticks every 6 hours, when 3 day every 24 hours, etc.

I've seen an example where someone overrides the GetTickValues method, but it seems that the Axis is setup to allow manual values. But HOW?

I'm using Xamarin on Android, and the graphs work very well! Great tool, just need to do some minor tweaking of the labels and I'll be done!

New Post: DateTime Label Formatter over 2 lines

$
0
0
My client wants the date time formatted on the Labels to be formatted with the date above the time, like this:

07/06
10:00 am

I have been unable to determine how to a) get it broken onto 2 lines, and b) how to get the am / pm designator.

I'm doing this using Xamarin for Android

Thanks in advance!

New Post: Printing in WPF with XPS/PrintVisual

$
0
0
Hi,

I also try to print graph as same way. But I couldn't it even if I call UpdateLayout().
When I create instance of user control on memory empty page is printed out.
But I throw showing visual object to PrintVisual() it's no problem.

Should I set any special configuration to user control(XAML/code behind)?
In my case, user control is very simple as following.
<UserControl
    x:Class="Reports.TestView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    mc:Ignorable="d" 
    xmlns:oxy="http://oxyplot.codeplex.com"
    d:DesignHeight="800" d:DesignWidth="600"
    >

    <Grid>
        <oxy:Plot>
            <oxy:Plot.Axes>
                <oxy:LinearAxis Position="Left" Minimum="0" Maximum="100"/>
                <oxy:TimeSpanAxis Position="Bottom" Minimum="0" Maximum="86400" StringFormat="hh:mm"/>
            </oxy:Plot.Axes>
            <oxy:Plot.Series>
                <oxy:LineSeries ItemsSource="{Binding Path=DataList}" DataFieldX="Time" DataFieldY="Value" Color="Red"/>
            </oxy:Plot.Series>
        </oxy:Plot>
    </Grid>
</UserControl>

New Post: Change axis textcolor in OxyPlot for WPF

$
0
0
Hi, I have one question. How is it possible to change color of axis text color in WPF? In OxyPlot.dll you have Axis.TextColor property which comes from OxyPlot.PlotElement class. But in OxyPlot.Wpf.dll you don't have Axis.TextColor property. Probably because Axis is not inherited from OxyPlot.PlotElement class but from System.Windows.FrameworkElement class.
So my question is: Is there some way how I can achieve this?

I also posted question on StackOverflow.

New Post: System.InvalidOperationException - OnKeyDown

$
0
0
Hi All,

I'm plotting real time data using OxyPlot, everything seems to be working great apart of the exception in 'PlotModel.ResetAllAxes' method. The exceptions occurs each time I press 'a' key when the focus is on the OxyPlot area.

Can you please advice how to fix this issue?
OxyPlot.dll!OxyPlot.PlotModel.ResetAllAxes() Line 1237  C#
 OxyPlot.dll!OxyPlot.PlotCommands.HandleReset(OxyPlot.IPlotView view) Line 235  C#
 OxyPlot.dll!OxyPlot.PlotCommands..cctor.AnonymousMethod__6(OxyPlot.IPlotView view, OxyPlot.IController controller, OxyPlot.OxyKeyEventArgs args) Line 44   C#
 OxyPlot.dll!OxyPlot.DelegatePlotCommand<OxyPlot.OxyKeyEventArgs>..ctor.AnonymousMethod__0(OxyPlot.IView v, OxyPlot.IController c, OxyPlot.OxyKeyEventArgs e) Line 47   C#
 OxyPlot.dll!OxyPlot.DelegateViewCommand<OxyPlot.OxyKeyEventArgs>.Execute(OxyPlot.IView view, OxyPlot.IController controller, OxyPlot.OxyInputEventArgs args) Line 76   C#
 OxyPlot.dll!OxyPlot.ControllerBase.HandleCommand(OxyPlot.IViewCommand command, OxyPlot.IView view, OxyPlot.OxyInputEventArgs args) Line 533    C#
 OxyPlot.dll!OxyPlot.ControllerBase.HandleKeyDown(OxyPlot.IView view, OxyPlot.OxyKeyEventArgs args) Line 348    C#
 OxyPlot.Wpf.dll!OxyPlot.Wpf.PlotView.OnKeyDown(System.Windows.Input.KeyEventArgs e) Line 588   C#
Many thanks,
Krzysztof

New Post: Printing in WPF with XPS/PrintVisual

$
0
0
If you are using the latest version of OxyPlot it wont work. I updated to the latest version some time ago, and the above code stopped working.

I downgraded to version "2014.1.231.1" and it works with that version, so they must have changed something in the underlying rendering code....

New Post: Tooltips for annotations

$
0
0
Thanks for the Sample! I build myself a PointAnnotation with tooltips enabled out of that:

With default ShapesRenderContext tooltip text only applies to text and images.
   public class TooltipPointAnnotation : PointAnnotation {
        /// <summary>
        ///     gets or sets the tooltip text
        /// </summary>
        public string Tooltip { get; set; }

        public override void Render(IRenderContext rc, PlotModel model) {

            /*  get render context */
            ShapesRenderContext src = rc as ShapesRenderContext;

            /* set tooltip to render context if it exists */
            if (src != null) {
                src.SetToolTip(Tooltip);
            }

            /* draw elements the tooltip may apply to (text and images) */
            base.Render(rc, model);
        }
    }
Given the above I get a nice point annotation with an tooltip on the annotation text.

New Post: Printing in WPF with XPS/PrintVisual

$
0
0
Thank you for your great information!
When I try to use 2014.1.231.1 from NuGet it works fine.

I checked changing point roughly. Cause is probably in InvalidatePlot() (Plot.cs or PlotView.cs).
From following version of source code, it has not rendered if it's not receive Loaded event.

revision : 824 / change set : ffbabf441bcea4e2871c8c86fc56dbe910b3f87f [ffbabf441bce]

This modification is for performance issue.

So... I added uncool code as following it seems be working on latest version of OxyPlot.
"graph" is name of Plot object (<oxy:Plot x:Name="graph">)
    dpc.Measure(new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight));
    dpc.Arrange(new Rect(new Point(0, 0), dpc.DesiredSize));
    dpc.graph.RaiseEvent(new System.Windows.RoutedEventArgs(OxyPlot.Wpf.PlotView.LoadedEvent));   
    dpc.UpdateLayout();
or
    dpc.Measure(new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight));
    dpc.Arrange(new Rect(new Point(0, 0), dpc.DesiredSize));
    dpc.graph.IsRendering = true;
    dpc.graph.InvalidatePlot(true);
    dpc.graph.IsRendering = false;
    dpc.UpdateLayout();
Of course this is not correct way... But currently it may be only way.
It should be modified or extended for our case.

New Post: Angled Labels in CategoryAxis

$
0
0
Hello

So I posted this problem here as well.

Basically I have a column chart and it's cutting off the bottom axis labels when I export to a png. All of the labels have the potential to be quite long so I'm trying to angle them at 30 or 45 degrees but they keep getting cut off.

I ensured that PlotModel.PlotMargins.Bottom == NaN and I've fiddled with a bunch of properties on CategoryAxis and PlotModel but have had no luck.

It also seems like this problem has existed for a while?

Just like I posted above, I put details here.

Am I doing something wrong or is this a longstanding issue that can only be resolved with a dirty hack?

New Post: Printing in WPF with XPS/PrintVisual

$
0
0
Thanks GuruK. Your hack works :-)

New Post: Axis displayed min and max tick labels

$
0
0
Hey, was wondering if there's a way to have an Axis always show it's visible min and max tick labels, regardless of it being a minor or major tick, just to have a number always displayed on the edges of it. Didn't really notice anything besides implementing it myself in a custom axis.

As a shitty example, here's a picture altered in paint, red and purple ticks and labels being two different ideas for where to show the visible min and maxes.
Image

New Post: Can attributes be added to the bar items SVG polygon for a bar series chart

$
0
0
I'm trying to find a way to add my own attributes to the polygon's that are rendered for a bar series chart,

Is this possible in any way? I've looked at extending the bar series and overriding the render method but have run into a few obstacles.

Any pointers to how to achieve this would be great.
Viewing all 1267 articles
Browse latest View live