yuankunzhang / charming

A visualization library for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

WaffleLapkin opened this issue · comments

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

I have encountered the same problem. Have you found a solution yet?