This is the discussion forum for OxyPlot.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!

plotting data on X-Axis based on days of the weeks sunday, monday,.......saturaday

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

Jivraj wrote at 2014-03-10 11:49:

I want to plot data in the chart such that x-axis of the graph should show the data on the basis of days of the week i.e i have data of the week then i wants to plot those data in x- axis or bottom axis i want to show sunday, monday ....... to saturday in that x-axis .Is it possible to show in x -axis.if possible then please suggest.

objo wrote at 2014-03-10 21:31:

I think the DateTimeAxis can support day names in the StringFormat. Try using "ddd" or "dddd". I think we should add some examples on this. Also note that there are a few issues related to the DateTimeAxis, I think this class is ready for an overhaul.

Jivraj wrote at 2014-03-18 06:44:

Thanks Objo for your kind Suggestions.

BarSeries with DateTimeAxis

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

sargent wrote at 2014-06-02 05:20:

I am looking to create a horizontal bar graph with a DateTimeAxis as my X axis
Image

From the research I have done it appears a RectangularBarSeries graph would work out best for me. I've looked around but can not find any good examples or documentation on this. Could someone provide a simple example to get me started? Thanks.

objo wrote at 2014-06-06 21:08:

Did you see the example RectangleBarSeriesExamples in the ExampleLibrary? I think it should be possible to use it with DateTimeAxis and CategoryAxis - just use DateTimeAxis.ToDouble to convert the DateTime values to numbers. And please create an example we can include in the ExampleLibrary!

How to increase DPI in PngExporter call to get higher quality image?

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

ambrein2 wrote at 2014-04-11 12:59:

Hi,

I am using PngExporter to export PlotModel to am image. By default dpi is 96 but that leaves some "jaggies" in the image so I want to increase dpi for better quality image. But when I increase dpi and try to use PngExporter the image that get's created is a zoomed in image. I don't want this, I want the height and width of the image to be same as that of the original height and width of the PlotModel. Any ideas how I can do that?

tibel wrote at 2014-05-15 09:57:

I have the same issue,
seems that PNG export does not work with different DPI (resolution) settings.

objo wrote at 2014-05-15 10:39:

Yes, I see there is a bug. I have added a test and https://oxyplot.codeplex.com/workitem/10199

objo wrote at 2014-05-15 21:19:

this should be fixed now

Dragging a Chart

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

AzureGulf wrote at 2012-09-11 00:23:

Hi Objo

Many thanks - I have just started using OxyPlot and it's cool - I've probably missed this in your documentation/discussions, but could you (or anyone) please tell me how I can enable dragging of a chart when the user clicks and holds down the left mouse button.

I have tried 'interaction.behavior' and 'interaction.triggers' with no success - I suspect that you might have taken over mouse gestures & interaction??

best regards


objo wrote at 2012-09-11 06:25:

Yes, the plot control handles the left clicks. I agree this should be customizable, this is already registered at http://oxyplot.codeplex.com/workitem/9625!


AzureGulf wrote at 2012-09-11 15:52:

Thanks for the quick response - will await the next version ;-)

Valuta next to axis value (solved)

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

Devin19 wrote at 2013-10-16 10:55:

I've made a chart showing amounts of money, and now I want to display the Valuta next to each value on the Y Axis.
Example:
€ 100 instead of 100

Can I manipulate the string that's shown somehow? There is no example doing something like this, and the documentation isn't covering it either.

everytimer wrote at 2013-10-16 15:26:

If you are using LineSeries you can use the LabelFormatString property:
var s1 = new LineSeries() {LabelFormatString = "€ {1:f2}"};
If you are using other series you will need modify the source code to include this behavior.
Good luck.

Devin19 wrote at 2013-10-16 15:41:

I'm using LineSeries, but doesn't this draw it in the chart itself?
I meant I'd like to see the € on the label at the axis on the left.
(I can't see the label in the chart since I'm using the Android version which doesn't support mouse events)

everytimer wrote at 2013-10-16 15:45:

Sorry, I don't quite understand what do you mean. If you want to display "€" on your axis, why not just modify the axis Title?
Good luck

Devin19 wrote at 2013-10-16 15:51:

No problem I didn't explain it good.
I could change the title, but I'd rather see the € sign at each value on the axis.

everytimer wrote at 2013-10-17 01:17:

Then it's just
myAxis.StringFormat = "0 €";
Good luck

Devin19 wrote at 2013-10-17 09:26:

Thanks a lot, that's exactly what I meant :)
0
Under review

Bind a column from a ColumnSeries with its Label from CategoryAxis

Lucas Miranda fa 9 anys updated by Oystein Bjorke fa 9 anys 1

I'm trying to build a ColumnSeries where instead of clustered bars I'd have just one item per 'group'. I'll try to give an example to illustrate the case:

- I have a collection with the items "Dog", "Cat, "Rat" and "Bird", each one with a (double)value that changes over time.

-I would like to plot a column chart, with the first bar being labeled as "Dog", second as "Cat", and so on. The bars must not be clustered.

-The chart will be updated given a refreshTimer, and it is possible to add new items to the chart, as well as changing or removing the existing ones.


My first approach was creating a generic ColumnSeries and add each of my items as ColumnItems. It worked at first, but when I had to implement the "Remove Item" operation, it became chaos as Labels from the CategoryAxis were not binded to the ColumnItem in any way. I tried to write a logic to solve the issue, but in the end, it failed. While trying this method, I did NOT set up the ItemSource of the CategoryAxis, instead I was adding and removing items from the ActualLabel manually.


On my second attempt, I'm trying to create a ColumnSeries for each of the items, but by doing so, I end up with 4 Labels ("Dog", "Cat", "Rat and "Bird"), each having a group of columns composed by another 4 columns, as each ColumnSeries has the same ItemSource holding all the Items I wanna plot. When I remove an Item, it removes the respective bar from each group, but does not remove its supposed Label (or group). This time, I had to set up the ItemSource from CategoryAxis (same ItemSource of the ColumnSeries), but I'm not sure if or how the bind works (for example, if I add an item to the collection of the ItemSource, will a new Label be created?).


If someone could guide me through a solution for this problem, I would highly appreciate. Thanks in advance.


PS: I can upload images if it helps understanding the case.

XAML properties values overwritten by the PlotModel

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

Gimly wrote at 2014-02-03 11:52:

Hello,

I was wondering about something a bit annoying when using the PlotModel in a MVVM scenario.

As the library is now, the PlotModel values overwrites all properties values that are defined directly in the XAML. This means that, when using the PlotModel, no properties can be set in the XAML.

This is annoying, because it means that some UI stuff must be set in the VM (where the PlotModel is setup).

I'm currently defining my PlotModel in my VM because it's too complex to be defined in the XAML only (dynamic number of series mostly). Even though this is a necessity for me, I still would like to define some things from the XAML.

For example, I would like to set a specific font for the Title of the plot. This is typically a UI stuff that my VM should have no knowledge about. Unfortunately, if I set it up in my XAML, it is overwritten by the default value when the biding of the PlotModel kicks-in.

So, my question, would it be possible to, when using XAML and databinding, prioritize the value set in the XAML (if it has been re-defined) over the value in the PlotModel?

Hope this is clear enough.

Thanks,
Gimly

objo wrote at 2014-02-04 19:20:

Good idea, added to https://oxyplot.codeplex.com/workitem/10128
Should not be very difficult to implement, I think.

Allow customization of tooltips

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

GeertvanHorrik wrote at 2014-03-11 10:09:

I have looked at the source and the combination of the annotations. Currently it is only possible to add tooltips via text. This won't allow me to add right aligned tooltips or use any elements in the tooltips.

Would it be feasible to allow FrameworkElement as well to be used (in the ShapesRenderContext of WPF / SL) as a tooltip?

Axis titles moved inside plot area after upgrade.

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

justslon wrote at 2014-04-28 11:41:

After upgrading OxyPlot.Core and OxyPlot.Wpf to version 2014.1.293.1 from 2014.1.271.1 I got all axis titles on my plots moved inside plot area! Is it desired behaviour or bug? In the Example Browser I see the same.

objo wrote at 2014-04-28 12:14:

Thanks for the notice! This is a bug. High priority.
https://oxyplot.codeplex.com/workitem/10189

objo wrote at 2014-04-29 12:23:

This issue should be fixed now.

justslon wrote at 2014-04-30 05:55:

Tried new version. Title position is ok now, but axes labels and title with right or top aligment draws outside of control area. Screenshot - http://yadi.sk/d/Dt3Obp1rNhVsw

ps. Thank you for very fast response!

UPD. It seems, that oxyplot incorrectly calculates auto-margins when plot have right or top axes. After setting PlotMargins manually (i. e. PlotMargins="60, 60, 60, 60") everything works just fine. Hope this info helps to solve issue.

objo wrote at 2014-04-30 09:27:

What is the value of the PlotMargins property of the PlotModel? Try to increase the top and right values or use the default value (NaN,NaN,NaN,NaN) to get 'automatic' margins.

justslon wrote at 2014-05-01 06:06:

Yes, when I changed PlotMargins to "NaN, NaN, NaN, NaN" in my XAML and now margins looks fine again. Thanks! But when I totally removed it from XAML - axis labels again draws beyond control edges. May be problem in oxyplot WPF adapter? Although workaround is easy. Thank you again!

objo wrote at 2014-05-02 23:11:

Yes, there was a bug in the WPF adapter. I fixed the wrong default value for PlotMargins in the OxyPlot.Wpf.Plot control and added some other missing properties. I also added a unit test that verifies the default values so this should not happen again.

OxyImage seems to be leaking huge amounts of memory

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

willmoore88 wrote at 2013-08-28 14:48:

Using an ImageAnnotation on a plot, each updates sets the ImageAnnotation.ImageSource with a new OxyImage. I'm using a memory profiler which shows me that these OxyImage objects are duplicating their datasource and not being cleared away as they never come out of context whilst the plot is active.

I'm not sure I 100% understand what it going on here but this is definitely the cause of my issues as just commenting out the line which creates the OxyImage solves the issue. Over an hour or so I am getting over 1GB of memory being used which in turn ends up in the application crashing.
            using (Bitmap b = updateScatterArray())
            {
                using (MemoryStream stream = new MemoryStream())
                {
                    b.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
                    stream.Seek(0, SeekOrigin.Begin);
                    image = new OxyImage(stream);


                    foreach (ImageAnnotation a in IntensityPlotModel.Annotations)
                    {
                        a.ImageSource = image;
                    }

                    IntensityPlotModel.RefreshPlot(true);
                    OnPropertyChanged("IntensityPlotModel");
                }
            }
Any help / pointers greatly appreciated. This is getting quite urgent now!! Ta.

willmoore88 wrote at 2013-08-28 15:19:

It seems that each time I update the OxyImage, there is an imageCache which is getting added to.

objo wrote at 2013-08-28 15:26:

Yes, and if the image is not used at the next update, it should be removed from the cache. Let us know if you find the bug!
See also https://oxyplot.codeplex.com/workitem/10042

willmoore88 wrote at 2013-08-28 15:27:

Ah yes, this is what is happening here too. Just found that other thread!

willmoore88 wrote at 2013-08-28 15:35:

Can you show me where you think CleanUp() is getting called at the minute? Because I can't seem to find it being called anywhere?

objo wrote at 2013-08-28 15:47:

I have submitted a fix - let us know if this solves the problem!

willmoore88 wrote at 2013-08-28 15:52:

Brilliant! I just did the exact same thing as was going to post it here! haha! Thanks very much!