Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 23 10:56
    VisualMelon commented #1266
  • Jan 23 10:23
    VisualMelon commented #1266
  • Jan 23 10:17
    VisualMelon commented #1266
  • Jan 23 10:08
    zhaokuohaha commented #1266
  • Jan 23 09:51
    VisualMelon commented #1266
  • Jan 23 09:44
    zhaokuohaha commented #1266
  • Jan 23 09:41
    zhaokuohaha commented #1266
  • Jan 23 09:37
    VisualMelon commented #1266
  • Jan 23 09:27
    VisualMelon commented #1266
  • Jan 23 07:00
    zhaokuohaha commented #1266
  • Jan 23 03:34
    zhaokuohaha commented #1266
  • Jan 22 09:21
    VisualMelon commented #1266
  • Jan 22 04:01
    zhaokuohaha commented #1266
  • Jan 22 03:57
    zhaokuohaha commented #1266
  • Jan 20 02:14
    nathanbennett commented #1737
  • Jan 19 21:12
    Sl1ckR1ck commented #1738
  • Jan 19 19:52
    VisualMelon labeled #1738
  • Jan 19 18:35
    Sl1ckR1ck opened #1738
  • Jan 19 09:47
    VisualMelon commented #1737
  • Jan 19 09:45
    VisualMelon labeled #1737
Wesley
@Wesley82198552_twitter
and I have my projects build set to any GPU, I assume x64
VisualMelon
@VisualMelon
AnyCpu means the assembly will run on any runtime; I think in all cases it defaults to x64 (where possible) but it's been a while since I had to resolve this sort of issue
I'm pretty sure Skia should 'just work' on either, but can you try setting the project to X64 (instead of AnyCpu) to see what happens?
There is some discussion in #1514 where we had to work this out for a testing project
VisualMelon
@VisualMelon
So I guess it isn't as easy as I remember...
Wesley
@Wesley82198552_twitter
switching to x64 works fine!
VisualMelon
@VisualMelon
Crickey, I guess I've just not had to use Framework for years: looks like you do need to specify it
Wesley
@Wesley82198552_twitter
Okay so the problem is likely specific to .NET framework. Thanks for your help @VisualMelon !
VisualMelon
@VisualMelon
Yeah, I'm not sure about this stuff, but there might be some intelligence in this comment thread if you have issues later on: https://github.com/oxyplot/oxyplot/pull/1514#discussion_r413172288
Wesley
@Wesley82198552_twitter
Great, will have a browse
Wesley
@Wesley82198552_twitter
Hi, I have just upgraded to the 2.1 preview with SkiaSharp.wpf. One side effect appears to be the custom fonts I was using for annotations and axis titles have reverted back to the default font. Previously, in the view model, I set the PlotModel's DefaultFont to null while in the plotview (xaml), I set the FontFamily to my custom font (stored as a resource .ttf file locally). This worked in 2.0 despite it probably not being good practice. Is there an alternative way to set the font to my custom font in 2.1?
I thought of changing my font.ttf to an embedded resource, then providing the full path to the plotmodel but this seems like overkill.
VisualMelon
@VisualMelon
Sorry, fonts and Skia are two things I know very little about, but I'm sure I've read about using custom fonts under Skia/Xamarin using resources; I assume it's the same under WPF
You will need to tell it to the PlotModel
actually, I should probably look at Skia plot view quickly...
Internally we just call SKTypeface.FromFamilyName, so actually this probably won't be easy
Yeah, looking properly, I don't think it will be possible
VisualMelon
@VisualMelon
If you can't register the font, then you'd have to load it from a resource
The only work-around I can think of would be to hook OnApplyTemplate and inject the font manually into the font-cache with reflection
Sorry, this doesn't look like it's going to be easy at all.
I'd suggest opening an Issue describing your use-case: maybe we can work out a suitable abstraction
(or perhaps implement loading from assemblies/file directly)
Wesley
@Wesley82198552_twitter
How would I go about loading from assemblies/file directly?
It probably wouldn't be silly to add a FontResolver extention point to SkiaRenderContext
(indeed, for all the render contexts)
Wesley
@Wesley82198552_twitter
Okay great, I will have a look at these implementations and if none work I will create an issue on github
VisualMelon
@VisualMelon
Well, the only way you can do it without source modification will be loading the assembly manually and injecting it with reflection
everything else is my musing about how we could make this less painful
Wesley
@Wesley82198552_twitter
I created an issue for this, oxyplot/oxyplot#1735
Wesley
@Wesley82198552_twitter

With Oxyplot core 2.1 preview, the plotmodel mouse events have been marked as soon to be obsolete. So I have started moving my events to the controller. I have noticed that the click count for an oxymousedownevent never returns more than 1. Shown in the code below.

        controller.BindMouseDown(OxyMouseButton.Left, new DelegatePlotCommand<OxyMouseDownEventArgs>(
            (view, _, args) =>
            {
                if (args.ClickCount >1)
                    return;

etc etc

VisualMelon
@VisualMelon
You need a separate binding for the different click counts
(i.e. double-click and single-click are treated independently)
At least, that is my understanding, I've not spent much time messing with controllers (my graphs usually end up as a PDF)
(that overload of BindMouseDown defaults to 1 click)
Wesley
@Wesley82198552_twitter
Ah I didnt see that overload, thanks again @VisualMelon !
VisualMelon
@VisualMelon
The documentation could certainly be clearer on that
maye1115
@maye1115
QQ截图20210118021547.png
Hello, how to make this red frame?
VisualMelon
@VisualMelon
Is that one plot-model?
If so, you'll need a custom annotation
There is an example that does almost that already
maye1115
@maye1115
yes
I'll try .
The method AddAxisMarginAnnotations has the code you'll need
You want the ActualMinimum and ActualMaximum
(unless you happen to be using a pre-release, in which case you should use the ClipMinimum and ClipMaximum)
(or, indeed, ScreenMin and ScreenMax, which are 'fixed' in the pre-release, I think)
maye1115
@maye1115
Yes I use the pre-release
I will do it right now.