Comments (9)
You should be able to do this as long as there is a way to load the font in the html enclosing the chart.
A quick search for me turned out that this must be done via css (https://stackoverflow.com/questions/64508137/how-to-use-ttf-as-font-family-in-html). You can include such a css file in your chart output head tags by usingh the DisplayOptions
API just as it is done here for the bulma stylesheet.
from plotly.net.
Hi, in my use case there is no web page for the chart, I need the svg-rendered chart so it can be embedded into a pdf file (server-side).
it is really strange because using a proper linux distro (debian 12) there is no font for the charts (squares instead of letters), using a wsl instance (debian 11) i got proper letters (dejavusansmono)
somehow it takes a "default font" from the wsl instance eventhough x-server is not installed.
from plotly.net.
Hi, in my use case there is no web page for the chart, I need the svg-rendered chart so it can be embedded into a pdf file (server-side).
You will still need the html page to display properly, because rendering as svg is done in a headless browser. So i would expect everything to work once you manage the chart to reference the font via css
from plotly.net.
could you maybe attach the svg that has no font as well? maybe that helps narrowing it down
from plotly.net.
Here is the sample SVG
it seems a valid file, but when it is attached to the PDF it has wrong letters (font)
from plotly.net.
it seems a valid file, but when it is attached to the PDF it has wrong letters (font)
Are you creating that pdf programmatically? You can include fonts in pdfs, so that might be a solution for you.
I did some digging and this is not natively supported in plotly.js either (see here for reference). This means you have to either patch the generated SVG or the PDF with your custom font if you want to make the files self contained.
from plotly.net.
Hi @kMutagene, thanks for the references, will test and come back with the results
The PDF file is created programmatically using QuestPDF (already created an issue about this behavior), it includes the fonts that are required. QuestPDF Issue
Using Plotly.js (client side) I had no troubles creating PDFs using pdfmake, the approach was the same, render the chart in SVG format then embed in the PDF document.
from plotly.net.
Using Plotly.js (client side) I had no troubles creating PDFs using pdfmake, the approach was the same, render the chart in SVG format then embed in the PDF document.
Could you maybe also attach that pdf that is working here? maybe we can spot a difference between the 2
from plotly.net.
As I've mentioned in the linked QuestPDF issue, I have the same issue with QuestPDF and ScottPlot 5, so it might be an issue on the QuestPDF side.
from plotly.net.
Related Issues (20)
- Chart descriptions do not work if Cytoscape.NET.Interactive is referenced simultaneously HOT 4
- Contours should be accessible for PointDensity charts HOT 1
- How to create polar plots with Csharp HOT 3
- Suggestion: Documentation / Examples / Extensions for working with DataFrame objects HOT 1
- Exception when using .NET Polyglot Notebook due to strong naming HOT 3
- Add `WithTraceStyle` extension member to Plotly.NET.CSharp
- Plotly.Net.ImageExport ToBase64JPGString hangs in Blazor Server Application HOT 4
- With lastest plotly.net version (4.2), when plotting a Bubble3D chart ( or Scatter3D), x/y axis cannot be renamed HOT 4
- Unable to change the legend font size when global font size is defined in layout HOT 1
- plotly.js v2.28.0 compatibility needs huge rework of core API HOT 1
- Rework docs to use polyglot notebooks HOT 5
- Pie Chart's background doesnt change HOT 7
- No way to add guidelines (plotly.js has them) HOT 3
- Update documentation to dotnet interactive to 4.2.1 HOT 1
- `StyleParam.HoverInfo` is missing enum bindings
- Charts marked as `Responsive = true` are not responsive HOT 9
- Annotation not showing in C# HOT 2
- LinearAxis CategoryOrder not working as expected HOT 3
- Giraffe.ViewEngine.StrongName breaks compatability with Giraffe server HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plotly.net.