Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rendering echarts svgStr leads to electron software crash #286

Closed
RizerKayseri opened this issue Jan 9, 2024 · 4 comments
Closed

rendering echarts svgStr leads to electron software crash #286

RizerKayseri opened this issue Jan 9, 2024 · 4 comments

Comments

@RizerKayseri
Copy link

RizerKayseri commented Jan 9, 2024

chart.setOption(res.option)
// 输出字符串
let svgStr = chart.renderToSVGString()
const opts = {
  background: 'rgba(238, 235, 230, .9)',
  fitTo: {
    mode: 'width',
    value: 1200
  },
  font: {
    fontFiles: ['resources/huakang.ttf'], // Load custom fonts.
    loadSystemFonts: false, // It will be faster to disable loading system fonts.
    defaultFontFamily: 'myfont'
  },
  // imageRendering: 1,
  // shapeRendering: 2,
  logLevel: 'debug' // Default Value: error
}
const resvg = new Resvg(svgStr, opts)
console.log(resvg.width)
const pngData = resvg.render()
const pngBuffer = pngData.asPng()

thread '<unnamed>' panicked at C:\Users\runneradmin\.cargo\git\checkouts\resvg-4b7e4ee32ad6d954\3495d87\crates\resvg\src\geom.rs:27:61: calledOption::unwrap()on aNonevalue stack backtrace: 0: 0x7ffdeb2bcfc8 - napi_register_module_v1 1: 0x7ffdeb12589b - <unknown> 2: 0x7ffdeb2b0071 - napi_register_module_v1 3: 0x7ffdeb2bf33a - napi_register_module_v1 4: 0x7ffdeb2bef59 - napi_register_module_v1 5: 0x7ffdeb2bff02 - napi_register_module_v1 6: 0x7ffdeb2bf973 - napi_register_module_v1
It can get width successfully

@yisibl
Copy link
Member

yisibl commented Jan 9, 2024

Please paste the SVG string in the issue.

@RizerKayseri
Copy link
Author

Please paste the SVG string in the issue.
I'm pleasantly surprised and delighted to share that during my assessment today, this particular issue seemed to have vanished, rendering the program crash-free. May I inquire if an update has resolved this issue?

@yisibl
Copy link
Member

yisibl commented Jan 18, 2024

Looks like a similar issue to #287.

@RizerKayseri
Copy link
Author

Looks like a similar issue to #287.
Prior to the update, i will employ version 2.5. Grateful acknowledgments are extended for your invaluable assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants