react-native-echarts icon indicating copy to clipboard operation
react-native-echarts copied to clipboard

SkiaChart: Texts including axis labels, tooltips, toolbox and legend are not rendered.

Open nipunadodan opened this issue 9 months ago • 26 comments

Describe the bug Texts including axis labels, tooltips, toolbox and legend are not rendered.

To Reproduce Steps to reproduce the behaviour:

  • Try a minimal example using SkiaChart with the below library versions.
"@wuba/react-native-echarts": "^1.3.1",
"@shopify/react-native-skia": "^0.1.241",
"echarts": "^5.5.0",
"react": "18.2.0",
"react-native": "^0.73.4",

Expected behaviour Texts on axis labels, tooltips, legends and toolbox should be visible.

Screenshots This is how it looks like when it is rendered using SkiaChart image

This is how it is expected to look (screenshot taken after rendered using SVG) image

Desktop (please complete the following information):

  • OS: Ubuntu
  • Browser: N/A
  • Version: 22.04.4

Smartphone (please complete the following information):

  • Device: Samsung A12
  • OS: Android 13
  • Browser: N/A
  • Version: N/A

Additional context Sample code: Github gist

nipunadodan avatar May 13 '24 09:05 nipunadodan

use rnsvg or lower version of rnskia

zhiqingchen avatar May 14 '24 12:05 zhiqingchen

https://github.com/Shopify/react-native-skia/issues/2404

zhiqingchen avatar May 14 '24 12:05 zhiqingchen

use rnsvg or lower version of rnskia

I switched to SvgChart and it worked, but is there any implication I should be aware of?

Thank you.

AlejandroRM-DEV avatar May 21 '24 18:05 AlejandroRM-DEV

https://github.com/wuba/react-native-echarts/issues/16 @AlejandroRM-DEV

zhiqingchen avatar May 22 '24 03:05 zhiqingchen

use rnsvg or lower version of rnskia

I switched to SvgChart and it worked, but is there any implication I should be aware of?

Thank you.

Yes, I'm aware. SvgCharts works but it's slow to respond to gestures. That's why I explicitly need SkiaChart to work.

nipunadodan avatar May 22 '24 04:05 nipunadodan

@nipunadodan yes I am having exactly same issue with you. so any solution yet?

Jay2009 avatar May 24 '24 11:05 Jay2009

@Jay2009 Below is what we've done as a workaround for now. It's not ideal but might help you (as long as you don't need react-native-skia for anything bar react-native-echarts on iOS).

@shopify/react-native-skia 0.1.234 is the last version that will render text in react-native-echarts. That version will crash/lock up an iOS app on RN 0.73.8 (the version of RN we're using, I haven't tried 0.74.x yet) but seems to work fine on Android. We want Skia rendering for slow Android devices as it's faster than SVG rendering. The iOS devices will use SVG rendering for now (since they have generally stronger performance).

How to set this up:

  • Downgrade @shopify/react-native-skia to 0.1.234 in your package.json.
  • Disable auto-linking of the module on iOS only by putting the following in your react-native.config.js (there's no point linking it if we can't use it):
module.exports = {
    dependencies: {
        '@shopify/react-native-skia': {
            platforms: {
                ios: null
            }
        }
    }
}
  • Update our React component to use either SkiaChart or SvgChart depending on platform:
const SomeComponent = () => {
    const PlatformSpecificChartTag = Platform.OS === 'ios' ? SvgChart : SkiaChart
    return <PlatformSpecificChartTag option={...} etc />
}

liamjones avatar May 24 '24 11:05 liamjones

Now that react-native-skia have documented that text in ImageSVG tags is not going to be supported could we add that to the known issues on https://github.com/wuba/react-native-echarts/issues/16?

liamjones avatar Jun 03 '24 13:06 liamjones

I got the same issue, all Legend + Axises are blank, do we have a plan to fix that or is there a patch/hack in the meaning time ?

hthieu1110 avatar Aug 05 '24 11:08 hthieu1110

We can't use it until we do a big refactoring, or

  1. You can also use the old version of skia.
  2. Use react-native-svg for rendering

@hthieu1110

zhiqingchen avatar Aug 06 '24 02:08 zhiqingchen

thankss @zhiqingchen , in our case we have to enable RN New Architect which is not supported by old version of Skia. So react-native-svg is a working option (but is quite slow in comparison with Skia). So we are looking forward for the new-refactored version :D

Thanks @zhiqingchen again for your reply.

hthieu1110 avatar Aug 06 '24 03:08 hthieu1110

I am working on the 2.x branch, and there has been some progress, but there is still a lot of work to be done.

If you are interested, please review the code and provide me with some feedback.

Rendered by skia above and rendered by svg below, skia also supports shadow, which is a nice feature.

zhiqingchen avatar Aug 06 '24 09:08 zhiqingchen

hi @zhiqingchen , how can i try the 2.x branch, i can test it for you.

ducpt-bili avatar Aug 07 '24 09:08 ducpt-bili

  1. Clone this repo
  2. switch to 2.x branch
  3. yarn
  4. cd example
  5. yarn android/ios
  6. debug in src/example dir

@ducpt-bili

zhiqingchen avatar Aug 07 '24 14:08 zhiqingchen

Hi @zhiqingchen , I did like you said and here is the error.

  1. OK
  2. OK
  3. yarn => fail with multiple error of TS.
  4. OK
  5. Error like image below Screenshot 2024-08-07 at 22 12 32

ducpt-bili avatar Aug 07 '24 15:08 ducpt-bili

hi @zhiqingchen , any news on the version 2. Thanks.

ducpt-bili avatar Aug 27 '24 01:08 ducpt-bili

dev version 2.0.0-canary.0

sample code https://github.com/wuba/react-native-echarts/blob/2.x/example/src/App.tsx

zhiqingchen avatar Aug 27 '24 03:08 zhiqingchen

Following. Have the same problem.

anon-r-7 avatar Aug 29 '24 20:08 anon-r-7

hi @anon-r-7 , did you follow the @zhiqingchen guide and have the same problem like me?

ducpt-bili avatar Aug 30 '24 02:08 ducpt-bili

Yeah, I mean the whole reason I chose echarts over victory was for performance with skia. If I'm back down to svg anyways I'm not sure what the win is. Naturally I cannot downgrade RN, if anything I need to upgrade RN. I'm optimistic that zhiqingchen will have a solution soon. I'm tentatively using svg renderer until then.

anon-r-7 avatar Aug 30 '24 13:08 anon-r-7

hi @zhiqingchen , i able to run your 2.x example successfully, but it have some bug:

  1. On android, text is showing, but tool tip not working on Skia chart.
  2. On ios, text is NOT shoing, but tooltop is working on Skia chart. Thank you for your hard work.

ducpt-bili avatar Sep 04 '24 07:09 ducpt-bili

@ducpt-bili thanks. Please provide the code of the bug.

zhiqingchen avatar Sep 04 '24 08:09 zhiqingchen

hi @zhiqingchen , i just run the code in the example folder on 2.x branch, not add any thing new to it. Both android and ios i run is in simulator or emulator.

ducpt-bili avatar Sep 04 '24 08:09 ducpt-bili

hi @zhiqingchen , is there anything i can help for testing?

ducpt-bili avatar Sep 20 '24 01:09 ducpt-bili

https://github.com/wuba/react-native-echarts/pull/193 Related discussion moved to this PR, your previous feedback question we have not repeated.https://github.com/user-attachments/assets/c3ab96f8-3320-4406-9699-cdd9bb02005a

zhiqingchen avatar Sep 20 '24 12:09 zhiqingchen

hi @zhiqingchen , thank you. Maybe i will wait for version 2 release to make sure my setup is up-to-date. Right now maybe some mismatch setup will happen.

Thank you again.

ducpt-bili avatar Sep 20 '24 13:09 ducpt-bili

try 2.0.0-canary.3

zhiqingchen avatar Oct 11 '24 09:10 zhiqingchen

@zhiqingchen let me take a quick test. Thank you.

ducpt-bili avatar Oct 11 '24 09:10 ducpt-bili

I met this error below on ios simulator 17.4 when try 2.0.0-canary.3, with Skia chart. Note: it work with previous version on Skia and when i change to SVG chart it work. I try simple line chart example on documents and meet this same issue.

Screenshot 2024-10-11 at 16 52 15 cc @zhiqingchen

ducpt-bili avatar Oct 11 '24 09:10 ducpt-bili

try this demo @ducpt-bili https://github.com/zhiqingchen/react-native-echarts-test image

zhiqingchen avatar Oct 11 '24 10:10 zhiqingchen