如何在angular-chart.js中颜色图例 [英] How to color legend in angular-chart.js

查看:507
本文介绍了如何在angular-chart.js中颜色图例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是



编辑:我不是愿意自己定义任何颜色!图表本身获得自己的颜色。我们应该这样离开。

解决方案

您似乎缺少对html文件中样式表的引用。 angular-chart.css


the very last example in this section of angular-chart.js documentation shows a pie/polar chart example with a colored legend. Obviously, this should be my answer, but:

I used this code for my frontend (which is pretty much the same as in the doc):

<canvas id="base" 
        class="chart-pie" 
        chart-type="type" 
        chart-data="data" 
        chart-labels="labels" 
        chart-legend="true">
</canvas>

I did also use the same data and labels. But unfortunately the legend of the rendered plot consists out of list-bullet-points and the labels (see enclosed image) This happens to all charts I create with this library. Does anybody know this behavior or (even better) any solution for that problem?

I am using angular/typescript and bound the DefinitelyTyped file to my project.

EDIT: I am not willing to define any colors by myself! The chart gets its own colors by itself. We should leave it like that.

解决方案

It seems you are missing the reference to a style sheet in your html file. angular-chart.css

这篇关于如何在angular-chart.js中颜色图例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆