akveo / ngx-admin

Customizable admin dashboard template based on Angular 10+
https://akveo.github.io/ngx-admin/
MIT License
25.23k stars 7.95k forks source link

How to display legends in cahrt.js charts? #1150

Closed meghsmayur closed 5 years ago

meghsmayur commented 7 years ago

I am not able to get legends in charts, I am using chart.js. Is there any way to get legends. And on hover i want to see the chart data, is that feasible?

jarredszabadi commented 7 years ago

also interested in this feature

bankszorsqt commented 7 years ago

I am searching for the same answer, tho little update, its plugins for chartistjs, that need to be included, but "how" part is tricky. And yes chartist charts are useless without those basic features, like values on points, legend and axis names. Please, anyone, share your experience with this.

MarAvFe commented 7 years ago

I've been trying to implement tooltip and zoom plugins, but can't get to the importing the library part. Once installed the chartist-plugin-tooltip I think to include the plugin options on the charts service, but the instruction Chartist.plugins.tooltip() doesn't find the Chartist component. I've tried including on my service directly like import * as 'Chartist' from 'chartist' and import * as 'Chartist' from 'chartist-plugin-tooltip' or both, but compiler can't find it.

bankszorsqt commented 7 years ago

@MarAvFe the same thing. I gave up on that one and switched to amCharts. With minor tweaks on onChanges hook, it works like charm. I recommend it. + I found this useful a lot while creating charts that suit my needs. https://live.amcharts.com/new/

undermoodzyx commented 6 years ago

below is my workaround to display legend

import chartLegend from 'chartist-plugin-legend';
public simpleBarOptions = {
        plugins: [
            chartLegend({
                legendNames: ['order', 'paid'],
                clickable: false
            }),
            // barLabel(),
            // Chartist.plugins.tooltip()
        ]
    };