我正在构建一个基于dc.js的可视化,其中一个图表是一个饼图.看到:
http://jsfiddle.net/luiseth/t8we6/
我的例子的特点是这个图表显示的标签通常很长,通常会被图表的容器(the <div>)剪掉.所以我想让它们出现在一个传奇中,但我还没有想到如何让图例出现在图表的右侧.我怎样才能做到这一点?玩这个width没有任何帮助,因为图表位于该中心<div>.
我的代码目前是:
chart.width(500)
.height(180)
.radius(80)
.dimension(categoryDimension)
.group(categoryGroup)
.legend(dc.legend().x(140).y(0).gap(5));
Run Code Online (Sandbox Code Playgroud)
另外还有一个.label指令用百分比替换标签.
我使用 CGAL 的 Kd 树实现以及模糊球体作为查询对象来获取以某个点为中心的半径球体中包含的点r_max。这是这个最小的工作示例:
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Kd_tree.h>
#include <CGAL/Search_traits_2.h>
#include <CGAL/Fuzzy_sphere.h>
#include <iostream>
#include <fstream>
typedef CGAL::Simple_cartesian<double> K;
typedef K::Point_2 Point;
typedef CGAL::Search_traits_2<K> TreeTraits;
typedef CGAL::Kd_tree<TreeTraits> Kd_tree;
typedef Kd_tree::Tree Tree;
typedef CGAL::Fuzzy_sphere<TreeTraits> Sphere;
int main(int argc, char* argv[])
{
double r_max;
Tree tree;
/* ... fill the tree with points, set the value of r_max ...*/
// Report indices for the neighbors within a sphere
unsigned int idc_query = tree.size()/2; // test index
Tree::iterator kti = …Run Code Online (Sandbox Code Playgroud)