Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Abstract class error for "TickOptions" #33

Open
basevers opened this issue Nov 13, 2018 · 11 comments
Open

Abstract class error for "TickOptions" #33

basevers opened this issue Nov 13, 2018 · 11 comments

Comments

@basevers
Copy link

basevers commented Nov 13, 2018

After the port to 2.0.0, now seeing this issue with the code below:

Abstract classes can't be created with a 'new' expression.

var config = new ChartConfiguration( type: 'line', data: data, options: new ChartOptions( responsive: true, scales: new ChartScales(type: 'linear', yAxes: [new ChartYAxe(type: 'linear', ticks: new TickOptions(min: 3000, max: 110000))])));

It seems the issue is similar to this issue:
#26 (this fixed "ChartYAxe")
and / or
#22

@alfinbi
Copy link

alfinbi commented Sep 3, 2019

Almost a year and still no fix for the missing factory constructor

@kevmoo
Copy link
Contributor

kevmoo commented Sep 5, 2019 via email

@oeztuerk
Copy link

@alfinbi

Like @basevers mentioned, this issue is similar to #26 and #22. I solved it by creating the missing factory class with it's attributes in the (Linear)TickOptions class, so it's not abstract anymore and you can create an instance of it:

external factory TickOptions({
dynamic min,
dynamic max
});

Don't forget to rebuild the project after manually updating the chartjs package.

@alexflav23
Copy link

@kevmoo This is a dart facade generator bug as far as I understand, please correct me if I am wrong. Does the project ever get re-generated? In which case the JS facade bugs would clear out manually re-added missing external factories? Need a bit of guidance here, as we're being bit really hard bit some of the Chart lib options not being there.

Happy to PR as needed, this is a small easy task, but just wanted to clear up things beforehand. Not sure if the facade output is a repository that sees a lot of love post auto-generation.

@Verzu23
Copy link
Contributor

Verzu23 commented Apr 14, 2021

I also have this problem, I can't set max, min or anything else because the class can't be initialized.
I think we need to add constructors for the classes TickOptions and so for the other.

Anyone can help?

@kevmoo
Copy link
Contributor

kevmoo commented Apr 14, 2021

PRs welcome!

@Verzu23
Copy link
Contributor

Verzu23 commented Apr 14, 2021

I don't know how to make pr.
If you can guide me, I will push my changes...

@tomas-kucera
Copy link
Contributor

The fix works but misses the rest of the attributes.

@Verzu23 - would you, please, add all the available options for the respective classes? Thanks!

@Verzu23
Copy link
Contributor

Verzu23 commented May 14, 2021

Hi @tomas-kucera , i will do it tonight and also take a look to your issue #51

@tomas-kucera
Copy link
Contributor

Great! Thanks!

I am also looking into Locale for proper number formatting. If I get it working, I will publish the ticket and solution. ;)

@Verzu23
Copy link
Contributor

Verzu23 commented May 17, 2021

Hi @tomas-kucera, at this moment you can use default constructor like:

analysisChart.config.options.scales.yAxes.first.ticks = LinearTickOptions(min: 0, max: maxScale);
analysisChart.config.options.scales.yAxes.first.ticks.showLabelBackdrop = true;

and so on.

analysisChart.config.options.scales.yAxes.first.ticks = LinearTickOptions();
analysisChart.config.options.scales.yAxes.first.ticks.min = 0;
analysisChart.config.options.scales.yAxes.first.ticks.max = maxScale;
analysisChart.config.options.scales.yAxes.first.ticks.showLabelBackdrop = true;

Or just like

Let me know if i miss something about your issue...

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

No branches or pull requests

7 participants