Skip to content

Rendering failure when generating bubble charts #643

Description

@schaumb

Generating a bubble chart can sometimes result in a display issue.

In very rare cases, execution reaches

// TODO bubblechart generation failed. It need a fix.

The unit tests below do not directly hit this code path, but they help illustrate how execution can reach it.

Image Image
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>

#include "../util/test.h"

#include "chart/speclayout/bubblechart.h"

using test::operator""_suite;
using test::check;

const static auto tests =
	"Chart::Bubblechart"_suite
	| "short fail" |
	[]
	{
		std::vector<double> areas;
		areas.insert(areas.end(), 7, 1.0);
		areas.insert(areas.end(), 34, 0.1);
		auto&& bc{Vizzu::Charts::BubbleChart(areas)};
		auto&& nextCirc = bc.markers.at(8).circle();
		auto&& lastCirc = bc.markers.back().circle();

		check->* (nextCirc.center - lastCirc.center).abs() >= nextCirc.radius + lastCirc.radius;

	}

	| "long fail" |
	[]
	{
		std::vector<double> areas;
		areas.insert(areas.end(), 6, 1.0);
		areas.insert(areas.end(), 1, 0.64);
		areas.insert(areas.end(), 124, 0.008);
		auto&& bc{Vizzu::Charts::BubbleChart(areas)};

		auto&& nextCirc = bc.markers.at(12).circle();
		auto&& lastCirc = bc.markers.back().circle();
		check->* (nextCirc.center - lastCirc.center).abs() >= nextCirc.radius + lastCirc.radius;
	};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions