GithubHelp home page GithubHelp logo

yuankunzhang / charming Goto Github PK

View Code? Open in Web Editor NEW
1.5K 1.5K 48.0 1.54 MB

A visualization library for Rust

License: Apache License 2.0

JavaScript 15.35% Rust 84.52% Handlebars 0.11% HTML 0.03%
chart data-science rust visualization webassembly

charming's Introduction

Charming - A Rust Visualization Library

crates.io docs.rs discord

Charming is a powerful and versatile chart rendering library for Rust that leverages the power of Apache ECharts to deliver high-quality data visualizations. Built with the Rust programming language, this library aims to provide the Rust ecosystem with an intuitive and effective way to generate and visualize charts, using a declarative and user-friendly API.

Highlights:

  • Easy-to-use, declaritive API.
  • Abundant chart types with rich and customizable chart themes and styles.
  • Ready to use in WebAssembly environments.
  • Rendering to multiple formats, including HTML, SVG, PNG, JPEG, GIF, WEBP, PNM, TIFF, TGA, DDS, BMP, ICO, HDR, OPENEXR, FARBFELD, AVIF, and QOI.

Themes

Default

Default

Dark

Dark

Vintage

Vintage

Westeros

Vintage

Essos

Essos

Wonderland

Essos

Walden

Walden

Chalk

Chalk

Infographic

Infographic

Macarons

Macarons

Roma

Roma

Shine

Shine

Purple Passion

Purple Passion

Halloween

Halloween

Future versions of Charming will support custom themes.

Basic Usage

Add charming as a dependency:

$ cargo add charming

Refer to the documentation of the Chart struct for how to create a chart with various components.

Once you create a chart, you can render it into various format. Charming provides three types of renderers:

  • HTML renderer: HtmlRenderer renders a chart into an HTML fragments and offloads the actual rendering to user's web browser for an interactive, seamless experience. This renderer is useful when you want to render a chart on the client side, e.g., in a web application.
  • Image renderer: ImageRenderer renders a chart into an image file. This renderer makes use of an embed deno_core engine to execute the JavaScript code of Echarts and generate an image file. This renderer is disabled by default, and you need to enable the ssr (Server-Side Rendering) feature to use it.
  • WASM renderer: WasmRenderer renders a chart in a WebAssembly runtime. This renderer is disabled by default, and you need to enable the wasm feature to use it. Note that the wasm feature and ssr feature are mutually exclusive.

Here is an example of drawing a simple pie chart into an SVG file:

use charming::{
    component::Legend,
    element::ItemStyle,
    series::{Pie, PieRoseType},
    Chart, ImageRenderer
};

fn main() {
    let chart = Chart::new()
        .legend(Legend::new().top("bottom"))
        .series(
            Pie::new()
                .name("Nightingale Chart")
                .rose_type(PieRoseType::Radius)
                .radius(vec!["50", "250"])
                .center(vec!["50%", "50%"])
                .item_style(ItemStyle::new().border_radius(8))
                .data(vec![
                    (40.0, "rose 1"),
                    (38.0, "rose 2"),
                    (32.0, "rose 3"),
                    (30.0, "rose 4"),
                    (28.0, "rose 5"),
                    (26.0, "rose 6"),
                    (22.0, "rose 7"),
                    (18.0, "rose 8"),
                ]),
        );

    let mut renderer = ImageRenderer::new(1000, 800);
    renderer.save(&chart, "/tmp/nightingale.svg");
}

This code creates the following SVG file:

As another example, the code file gallery/src/dataset/encode_and_matrix.rs draws a complex chart with four sub-charts:

Crate Feature Flags

The following two feature flags are available, note that they can't be used together:

  • ssr - Enables the ImageRenderer, which provides the capability to generate image files.
  • wasm - Enables the WasmRenderer, which provides the capability to render charts in WebAssembly runtime.

Renderers

// Use HtmlRenderer.
use charming::HtmlRenderer;

// Chart dimension 1000x800.
let renderer = HtmlRenderer::new("my charts", 1000, 800);
// Render the chart as HTML string.
let html_str = renderer.render(&chart).unwrap();
// Save the chart as HTML file.
renderer.save(&chart, "/tmp/chart.html").unwrap();


// Use ImageRenderer. The `ssr` feature needs to be enabled.
use charming::{ImageRenderer, ImageFormat};

// Chart dimension 1000x800.
let mut renderer = ImageRenderer::new(1000, 800);
// Render the chart as SVG string.
renderer.render(&chart).unwrap();
// Render the chart as PNG bytes.
renderer.render_format(ImageFormat::PNG, &chart).unwrap();
// Save the chart as SVG file.
renderer.save(&chart, "/tmp/chart.svg").unwrap();
// Save the chart as PNG file.
renderer.save_format(ImageFormat::PNG, &chart, "/tmp/chart.png");


// Use WasmRenderer. The `wasm` feature needs to be enabled.
use charming::WasmRenderer;

// Chart dimension 1000x800.
let renderer = WasmRenderer::new(1000, 800);
// Render the chart in the WebAssembly runtime
renderer.render(&chart).unwrap();

Themes

Charming supports a number of themes out of the box. You can use the Theme enum to specify a theme for your chart. For instance, the following code snippet shows how to use the Westeros theme:

use charming::{Chart, ImageRenderer};
use charming::theme::Theme;
use charming::component::Title;

ImageRenderer::new(1000, 800).theme(Theme::Westeros).save(
    &Chart::new().title(Title::new().text("Westeros")),
    "/tmp/westeros.svg",
);

Future versions of Charming will support custom themes.

Gallery

Here are some selected chart examples. Click on any single chart to view its source code file.

You can also clone the repo and run cargo run --bin gallery to view the interactive charts on the rendered HTML page.

Bar Charts

Bar with Background Basic Bar Radial Polar Bar Label Position Set Style of Single Bar Stacked Column Tangential Polar Bar Waterfall World Population

Boxplot Charts

Boxplot Light Velocity Multiple Categories

Candlestick Charts

Basic Candlestick Shanghai Index

Funnel Charts

Funnel Chart Multiple Funnels

Gauge Charts

Gauge Barometer Gauge Basic Gauge Simple

Graph Charts

Hide Overlapped Label Les Miserables

Heatmap Charts

Heatmap on Cartesian

Line Charts

Area Pieces Basic Area Basic Line Confidence Band Data Transform Filter Distribution of Electricity Gradient Stacked Area Large Scale Area Line Gradient Rainfall Rainfall Vs. Evaporation Smoothed Line Stacked Area Stacked Line Temperature Change Two Value-Axes in Polar

Parallel Charts

Basic Parallel Parallel AQI

Pie Charts

Nightingale Nightingale Referer of a Website

Radar Charts

Basic Radar Multiple Radar Proportion of Browsers

Sankey Charts

Basic Sankey Node Align Left Sankey Sankey Orient Vertical

Scatter Charts

Anscombe Quartet Basic Scatter Bubble Chart Effect Scatter Punch Card of Github

Sunburst Charts

Drink Flavors

Theme River Charts

Theme River LastFM

Tree Charts

From Left to Right Tree Multiple Trees

charming's People

Contributors

benpinno avatar dgsantana avatar hpmason avatar humphreylee avatar koopa1338 avatar mrchypark avatar mtk2xfugaku avatar qknight avatar samheuck avatar yuankunzhang avatar zishon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

charming's Issues

Polars Dataframe, ndarray and charming dataframe

Hi,
What are the differences between rust polars dataframe/ndarray and charming dataframe ? The polars and charming dataframe are both created with df! macro. Can I use polars/ndarray instead of charming dataframe ? If not, how to convert them to charming dataframe ?

JavaScript V8 engine

The JavaScript V8 engine was too difficult to download during initial compilation, are there any other solutions?

[feature request] Derive some useful traits

I want to suggest deriving Clone and PartialEq for charts and containing structs. Serialize and Deserialize for example could also be feature gated, if necessary. What do you think?

Candlestick Example

if I recall correctly, I remember at one point seeing an example for how to load data for candlesticks, but the example is now gone. Adding this back would be great since there's only the svg examples. I have a Polars Dataframe as my source.

roadmap

Hi,

Thanks for your great work! I am looking for rust visualization library for a long time. I have tried plotters (https://github.com/plotters-rs/plotters) and plotly (https://github.com/igiagkiozis/plotly), both of them are disappointing cannot meet my demand. Charming is the best one of all the rust visualization library I have ever seen and worth trying!

Do you have a roadmap of charming and will you maintain this project ? Though I am not a developer, I can test charming for you. And can I convert charming chart to json now using something like Chart.to_json() ? if so, I can send the json to web front end and render it. Besides, can I use charming in vscode jupyter and render them ?

Large candlestick charts not fully plotting

I have converted some polars dataframes into the underlying Vec types to pass into the charming df! macro and managed to build a working pipeline for making charts.
Running into an issue with a chart that starts from YTD for daily bars, and it compiles and saves the data into an html file.
When it comes to opening the file in the web browser it only renders a few bars and then nothing more. Even though the date axis and raw html data is fully available in the file.

Any leads on what I can try changing?
Screenshot 2023-08-07 234453

Screenshot 2023-08-07 231754

test_data.txt

Customized label

Hi,
how to show customized x-axis label for boxplot ? The example of boxplot of charming only show "expr 1", "expr2" ... for the boxes, which is meaningless.

ChartResize has no pub fields

I may be missing something, but I did not find a way to build a ChartResize structure since all of its fields are private.

Something as simple as

--- a/charming/src/renderer/wasm_renderer.rs
+++ b/charming/src/renderer/wasm_renderer.rs
@@ -76,6 +76,17 @@ pub struct ChartResize {
     animation: Option<Animation>,
 }

+impl ChartResize {
+    pub fn new(width: u32, height: u32, silent: bool, animation: Option<Animation>) -> Self {
+        ChartResize {
+            width,
+            height,
+            silent,
+            animation,
+        }
+    }
+}
+
 #[derive(Serialize)]
 pub struct Animation {

would solve the issue.

`ImageRenderer` only renders the first 400 points in a scatter graph

Reproducer:

use std::iter;

use charming::{component::Axis, element::AxisType, series::Scatter, Chart, ImageRenderer};

fn main() {
    let c = Chart::new()
        .x_axis(Axis::new().type_(AxisType::Value))
        .y_axis(Axis::new().type_(AxisType::Value))
        .series(
            Scatter::new().data(
                (0..=100)
                    .flat_map(|x| iter::zip(iter::repeat(x), 0..=100))
                    .map(|(x, y)| vec![x, y])
                    .collect(),
            ),
        );

    let mut renderer: ImageRenderer = ImageRenderer::new(1200, 1200);
    renderer.save(&c, format!("/tmp/chc.svg")).unwrap();
}

Result:
a scatter graph with 400 points arranged in 4 100 points tall columns

Expected result (a screenshot from html page made by HtmlRenderer):

a scatter graph with 10000 points distributed evenly in x<100, y<100 space

use::charming::WasmRenderer

I'm unable to use the renderer (and I can't find it anywhere else)

charming = { version = "0.1.2", feature = "wasm" }

But same for 0.2.1

error[E0432]: unresolved import `charming::WasmRenderer`
 --> src/main.rs:3:5
  |
3 | use charming::WasmRenderer;
  |     ^^^^^^^^^^------------
  |     |         |
  |     |         help: a similar name exists in the module: `HtmlRenderer`
  |     no `WasmRenderer` in the root

Live plots ??

Is live plotting of candlestick can be achieved through this library

chart-rs and charming

Hi,
Charts-rs is a charting library for rust. It's simple and fast. Charming is a powerful and versatile chart rendering library for Rust that leverages the power of ECharts to deliver high-quality data visualizations. Hope you guys can help each other and move rust visualization forward.

impl `Clone` on everything

Implement Clone on everything that allows it simply because there is nothing that speaks against it. Some third party libraries (like Leptos) require it.

NaiveDate compatibility for Chart x-axis

Hey, I've tried implementing a dynamic approach to initializing the x axis with a polars series of "Datetime" objects and my code compiles but panics when unwrapping the result of the chart creation. I screenshotted the ErrString, "expected Date got str"

I will fork and try to fix this issue, hopefully you may have some insight too.
Screenshot 2023-07-28 191807
Screenshot 2023-07-28 191608

Missing license file

The crate has "MIT/Apache-2.0" license but its missing on the repository itself

No support for u64 or usize

When I used a Vec containing u64 or usize to draw a graph, the following error is reported:

the trait bound NumericValue: From<u64> is not satisfied
the following other types implement trait From<T>:
<NumericValue as From>
<NumericValue as From>
required for u64 to implement Into<NumericValue>
required for CompositeValue to implement From<u64>
3 redundant requirements hidden
required for u64 to implement Into<DataPoint>

unresolved import charming::ImageRenderer

Compiling charm v0.1.0 (/home/xxx/rust/charm)
error[E0432]: unresolved import charming::ImageRenderer
--> src/main.rs:5:12
|
5 | Chart, ImageRenderer,
| ^^^^^^^^^^^^^ no ImageRenderer in the root

For more information about this error, try rustc --explain E0432.
error: could not compile charm (bin "charm") due to previous error

// here is the code
use charming::{                                                                                                                
    component::Legend,
    element::ItemStyle,
    series::{Pie, PieRoseType},
    Chart, ImageRenderer,
};
 
fn main() {
    let chart = Chart::new().legend(Legend::new().top("bottom")).series(
        Pie::new()
            .name("Nightingale Chart")
            .rose_type(PieRoseType::Radius)
            .radius(vec!["50", "250"])
            .center(vec!["50%", "50%"])
            .item_style(ItemStyle::new().border_radius(8))
            .data(vec![
                (40.0, "rose 1"),
                (38.0, "rose 2"),
                (32.0, "rose 3"),
                (30.0, "rose 4"),
                (28.0, "rose 5"),
                (26.0, "rose 6"),
                (22.0, "rose 7"),
                (18.0, "rose 8"),
            ]),
    );  
 
    let mut renderer = ImageRenderer::new(1000, 800);
    renderer.save(&chart, "/tmp/nightingale.svg");
}

Custom themes by deserializing JSON?

It would be nice to be able to use custom themes defined in a JSON or .toml file by deserialzing these into a custom theme struct.

A possible way to achieve this is by creating a CustomTheme struct with fields corresponding to the settings, while using preexisting structs from the crate. As those struct already has most of (if not all) of the needed fields, e.g the Line struct has line_style which is needed. The problem however is that the Line struct also has fields which are not required, nor wanted (?), for a theme struct - i.e the type_ (?) and the data field.

Is this something that is in the works? If wanted I could try to implement this, however, then there would be need for some guidance what needs to be done.

A small example of what I'm getting at..

use serde::{Serialize, Deserialize};

use charming::element::Color;
use charming::series::Line;

#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
struct CustomTheme {
    #[serde(skip_serializing_if = "Option::is_none")]
    color: Option<Vec<Color>>,

    #[serde(skip_serializing_if = "Option::is_none")]
    line: Option<Line>,
    // and then more... 
}

let theme: &str = r#"
{
    "color": ["\#ff0000", "\#00ff00", "\#0000ff"],
    "line": {
         "lineStyle"  : {
               "width": 3
          },
          "symbolSize": 8
     }
}
"#;

let my_custom_theme: CustomTheme = serde_json::from_str(theme).unwrap();

// Then set theme....

feat: Support decal patterns

Will there be support for decal patterns?

PS: Thank you for the library, it's great to work with. I wanted to use it for plots in publications, but could not find any option for decal patterns. It makes little difference on screen, but the bars are much easier to distinguish in B&W print when using patterns, so I wonder if they will be added later.

Discord link is broken

Hi,

I just wanted to point out that the recently committed discord invite is broken
(there also does not seem to be a charming server on discord)

Issue with running example on windows-gnu

Thanks for creating such a great crate. I tried to run your example on windows-gnu, but encountered error below. Upon tracing the error, there is no windows-gnu version of deno rusty. Not sure if I want to switch my rust to msvc version. Appreciate your help. Thanks.

Code:

use charming::{
    component::Legend,
    element::ItemStyle,
    series::{Pie, PieRoseType},
    Chart, ImageRenderer
};

fn main() {
    let chart = Chart::new()
        .legend(Legend::new().top("bottom"))
        .series(
            Pie::new()
                .name("Nightingale Chart")
                .rose_type(PieRoseType::Radius)
                .radius(vec!["50", "250"])
                .center(vec!["50%", "50%"])
                .item_style(ItemStyle::new().border_radius(8))
                .data(vec![
                    (40.0, "rose 1"),
                    (38.0, "rose 2"),
                    (32.0, "rose 3"),
                    (30.0, "rose 4"),
                    (28.0, "rose 5"),
                    (26.0, "rose 6"),
                    (22.0, "rose 7"),
                    (18.0, "rose 8"),
                ]),
        );

    let mut renderer = ImageRenderer::new(1000, 800);
    renderer.save(&chart, "/tmp/nightingale.svg");
}

Error messages

   Compiling if_chain v1.0.2
   Compiling lebe v0.5.2
error: failed to run custom build command for `v8 v0.81.0`

Caused by:
  process didn't exit successfully: `C:\Users\User1\elements\charm\rust\charming_ex1\target\debug\build\v8-37ec31db2e529d0e\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=.gn
  cargo:rerun-if-changed=BUILD.gn
  cargo:rerun-if-changed=src/binding.cc
  cargo:rerun-if-env-changed=CCACHE
  cargo:rerun-if-env-changed=CLANG_BASE_PATH
  cargo:rerun-if-env-changed=CXXSTDLIB
  cargo:rerun-if-env-changed=DENO_TRYBUILD
  cargo:rerun-if-env-changed=DOCS_RS
  cargo:rerun-if-env-changed=GN
  cargo:rerun-if-env-changed=GN_ARGS
  cargo:rerun-if-env-changed=HOST
  cargo:rerun-if-env-changed=NINJA
  cargo:rerun-if-env-changed=OUT_DIR
  cargo:rerun-if-env-changed=RUSTY_V8_ARCHIVE
  cargo:rerun-if-env-changed=RUSTY_V8_MIRROR
  cargo:rerun-if-env-changed=SCCACHE
  cargo:rerun-if-env-changed=V8_FORCE_DEBUG
  cargo:rerun-if-env-changed=V8_FROM_SOURCE
  cargo:rerun-if-env-changed=PYTHON
  cargo:rerun-if-env-changed=DISABLE_CLANG
  cargo:rerun-if-env-changed=EXTRA_GN_ARGS
  cargo:rerun-if-env-changed=NO_PRINT_GN_ARGS
  cargo:rustc-link-lib=static=rusty_v8
  cargo:rustc-link-lib=dylib=winmm
  cargo:rustc-link-lib=dylib=dbghelp
  download lockfile: "C:\\Users\\User1\\elements\\charm\\rust\\charming_ex1\\target\\debug\\build\\lib_download.fslock"
  static lib URL: https://github.com/denoland/rusty_v8/releases/download/v0.81.0/rusty_v8_release_x86_64-pc-windows-gnu.lib
  cargo:rustc-link-search=C:\Users\User1\elements\charm\rust\charming_ex1\target\debug\gn_out\obj
  Downloading https://github.com/denoland/rusty_v8/releases/download/v0.81.0/rusty_v8_release_x86_64-pc-windows-gnu.lib
  Downloading https://github.com/denoland/rusty_v8/releases/download/v0.81.0/rusty_v8_release_x86_64-pc-windows-gnu.lib...
  HTTP Error 404: Not Found
  Python downloader failed, trying with curl.

  --- stderr
  Traceback (most recent call last):
    File "C:\Users\User1\.cargo\registry\src\index.crates.io-6f17d22bba15001f\v8-0.81.0\tools\download_file.py", line 64, in <module>
      sys.exit(main())
               ^^^^^^
    File "C:\Users\User1\.cargo\registry\src\index.crates.io-6f17d22bba15001f\v8-0.81.0\tools\download_file.py", line 59, in main
      DownloadUrl(args.url, f)
    File "C:\Users\User1\.cargo\registry\src\index.crates.io-6f17d22bba15001f\v8-0.81.0\tools\download_file.py", line 45, in DownloadUrl
      raise e
    File "C:\Users\User1\.cargo\registry\src\index.crates.io-6f17d22bba15001f\v8-0.81.0\tools\download_file.py", line 29, in DownloadUrl
      response = urlopen(url)
                 ^^^^^^^^^^^^
    File "C:\Users\User1\msys2\clang64\lib\python3.11\urllib\request.py", line 216, in urlopen
      return opener.open(url, data, timeout)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\User1\msys2\clang64\lib\python3.11\urllib\request.py", line 525, in open
      response = meth(req, response)
                 ^^^^^^^^^^^^^^^^^^^
    File "C:\Users\User1\msys2\clang64\lib\python3.11\urllib\request.py", line 634, in http_response
      response = self.parent.error(
                 ^^^^^^^^^^^^^^^^^^
    File "C:\Users\User1\msys2\clang64\lib\python3.11\urllib\request.py", line 563, in error
      return self._call_chain(*args)
             ^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\User1\msys2\clang64\lib\python3.11\urllib\request.py", line 496, in _call_chain
      result = func(*args)
               ^^^^^^^^^^^
    File "C:\Users\User1\msys2\clang64\lib\python3.11\urllib\request.py", line 643, in http_error_default
      raise HTTPError(req.full_url, code, msg, hdrs, fp)
  urllib.error.HTTPError: HTTP Error 404: Not Found
  thread 'main' panicked at C:\Users\User1\.cargo\registry\src\index.crates.io-6f17d22bba15001f\v8-0.81.0\build.rs:431:3:
  assertion failed: status.success()
  stack backtrace:
     0:     0x7ff6c22e80da - std::backtrace_rs::backtrace::dbghelp::trace::h1e6812ea8adba5fb
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src\..\..\backtrace\src\backtrace/dbghelp.rs:131:5
     1:     0x7ff6c22e80da - std::backtrace_rs::backtrace::trace_unsynchronized::hb8761428bdde6a3f
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src\..\..\backtrace\src\backtrace/mod.rs:66:5
     2:     0x7ff6c22e80da - std::sys_common::backtrace::_print_fmt::ha78d891bef73c841
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src\sys_common/backtrace.rs:68:5
     3:     0x7ff6c22e80da - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0391ff925c868418
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src\sys_common/backtrace.rs:44:22
     4:     0x7ff6c231ab3d - core::fmt::rt::Argument::fmt::h10da764d6b07683e
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src\fmt/rt.rs:142:9
     5:     0x7ff6c231ab3d - core::fmt::write::h0d1a74662b4aa5bf
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src\fmt/mod.rs:1120:17
     6:     0x7ff6c22de8ed - std::io::Write::write_fmt::h3d21beac8e0d2508
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src\io/mod.rs:1810:15
     7:     0x7ff6c22e7f03 - std::sys_common::backtrace::_print::h9d61df6a0aa75173
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src\sys_common/backtrace.rs:47:5
     8:     0x7ff6c22e7f03 - std::sys_common::backtrace::print::h7d2e30433fe4fbf0
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src\sys_common/backtrace.rs:34:9
     9:     0x7ff6c22eacc9 - std::panicking::default_hook::{{closure}}::h31917a5ba9296998
    10:     0x7ff6c22ea9c8 - std::panicking::default_hook::h10d6ca42cdc89de3
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/panicking.rs:292:9
    11:     0x7ff6c22eb3b8 - std::panicking::rust_panic_with_hook::ha7d78ac18835b62c
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/panicking.rs:779:13
    12:     0x7ff6c22eb251 - std::panicking::begin_panic_handler::{{closure}}::h928711b767762e1f
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/panicking.rs:649:13
    13:     0x7ff6c22e8879 - std::sys_common::backtrace::__rust_end_short_backtrace::h933c5e8d5174ab9e
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src\sys_common/backtrace.rs:171:18
    14:     0x7ff6c22eafd2 - rust_begin_unwind
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/panicking.rs:645:5
    15:     0x7ff6c2317157 - core::panicking::panic_fmt::hc685bd5fdf74c15e
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src/panicking.rs:72:14
    16:     0x7ff6c2317212 - core::panicking::panic::haa5ab648900af052
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src/panicking.rs:144:5
    17:     0x7ff6c227b242 - build_script_build::download_file::h8f4cf28df0dbae98
    18:     0x7ff6c227b99c - build_script_build::download_static_lib_binaries::h88a22d18555d4de0
    19:     0x7ff6c2276e3c - build_script_build::main::ha511d5763763ac70
    20:     0x7ff6c228b4d6 - core::ops::function::FnOnce::call_once::h122611c92be75012
    21:     0x7ff6c2294279 - std::sys_common::backtrace::__rust_begin_short_backtrace::hc272eadac412c9c7
    22:     0x7ff6c22888ac - std::rt::lang_start::{{closure}}::h59b8aadf7afc35d0
    23:     0x7ff6c22d1a14 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h9c9a98f97d582a39
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src\ops/function.rs:284:13
    24:     0x7ff6c22d1a14 - std::panicking::try::do_call::hcdc83a0ea6591991
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/panicking.rs:552:40
    25:     0x7ff6c22d1a14 - std::panicking::try::h5ea3e86c54fef019
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/panicking.rs:516:19
    26:     0x7ff6c22d1a14 - std::panic::catch_unwind::h72ff0f43651fef39
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/panic.rs:142:14
    27:     0x7ff6c22d1a14 - std::rt::lang_start_internal::{{closure}}::he26c620c3984b7f8
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/rt.rs:148:48
    28:     0x7ff6c22d1a14 - std::panicking::try::do_call::h2d75c103da858a58
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/panicking.rs:552:40
    29:     0x7ff6c22d1a14 - std::panicking::try::h82d3d3826c0310a7
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/panicking.rs:516:19
    30:     0x7ff6c22d1a14 - std::panic::catch_unwind::hc04bca4bf5b3cc1d
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/panic.rs:142:14
    31:     0x7ff6c22d1a14 - std::rt::lang_start_internal::h6cebd8dd02653fdc
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src/rt.rs:148:20
    32:     0x7ff6c2288887 - std::rt::lang_start::haa6170a8085366d2
    33:     0x7ff6c228047f - main
    34:     0x7ff6c22712ee - __tmainCRTStartup
                                 at C:\M\B\src\build-UCRT64\C:/M/B/src/mingw-w64/mingw-w64-crt/crt\crtexe.c:267:15
    35:     0x7ff6c2271406 - mainCRTStartup
                                 at C:\M\B\src\build-UCRT64\C:/M/B/src/mingw-w64/mingw-w64-crt/crt\crtexe.c:188:9
    36:     0x7ffbd6ea257d - <unknown>
    37:     0x7ffbd84aaa58 - <unknown>
warning: build failed, waiting for other jobs to finish...

can't zoom by mouse

In JavaScript, if an image is too large, we can use mouse movements to pan and zoom the image. However, this is not possible in charming.

Slice of a polar plot

Is there a possibility of only displaying half of a polar plot?
As I can't seem to be able to do so.

Something like so:
2023-12-04_21-54

Could Echart be Clone?

I am embedding charming graphs inside leptos components. To handle canvas resizes correctly, I need to keep track of the Echart object in the reactive effect by inserting it in a leptos Read/WriteSignal. This requires Echart to be Clone, unless I am missing a a simpler solution.

Something like this would solve the issue:

--- a/charming/src/renderer/wasm_renderer.rs
+++ b/charming/src/renderer/wasm_renderer.rs
@@ -144,6 +155,8 @@ impl Animation {
 #[wasm_bindgen]
 extern "C" {
     #[wasm_bindgen(js_name = echarts)]
+    #[derive(Clone)]
     pub type Echarts;

     #[wasm_bindgen(js_namespace = echarts, js_name = init)]

Are there any drawbacks with this change?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.