Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to hide unknown line? #50

Open
4n70w4 opened this issue Jan 13, 2021 · 2 comments
Open

How to hide unknown line? #50

4n70w4 opened this issue Jan 13, 2021 · 2 comments

Comments

@4n70w4
Copy link
Contributor

4n70w4 commented Jan 13, 2021

Hi! I copy examples from readme and pass my parameters and data attributes:

    /**
     * Should return settings for Nova Chart in prescribed format
     *
     * @return array
     */
    public function getNovaChartjsSettings() : array {
        return [
            'default' => [
                'type' => 'line',
                'titleProp' => 'name',
                'identProp' => 'id',
                'height' => 400,
                'indexColor' => '#999999',
                'color' => '#FF0000',
                'parameters' => collect(self::data($this->getAttribute('id')))->pluck('k')->toArray(),
                'options' => ['responsive' => true, 'maintainAspectRatio' => false],
            ]
        ];
    }



    /**
     * Return a list of additional datasets added to chart
     *
     * @return array
     */
    public function getAdditionalDatasets(): array {
        return [
            'default' => [
                [
                    'label' => 'Distribution',
                    'borderColor' => '#f87900',
                    'fill' => '+1',
                    'backgroundColor' => 'rgba(20,20,20,0.2)',//For bar charts, this will be the fill color of the bar
                    'data' => collect(self::data($this->getAttribute('id')))->pluck('v')->toArray(),
                ],
            ]
        ];
    }

A line appears with the title of the Unknown. I don't understand how to remove it at all.

image

@dvanscott
Copy link
Member

@4n70w4 Can you just confirm what the final dataset that's being sent to the panel is? From this screenshot, it looks like there might be an extra array key (possibly empty) in the dataset that's causing that Unknown element to be displayed.

@4n70w4
Copy link
Contributor Author

4n70w4 commented Jan 14, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants