How hooks (plugins) and different phases in chart.js works? - chart.js

I read the documentation for chart.js plugins & about different phases like render,init,update available here that occurs while chart appears on browser.
But yet it is not clear for me how these different phases & hooks works.
And which hook to use when while making changes in chart.

Related

Unable to ES6 import ChartJS plugin into Aurelia

I'm using chart.js in my Aurelia application and it works fine.
I now want to add the chartjs-plugin-deferred plugin as well, and after having npm install:ed it and added it to aurelia.json's dependencies array I now get the following error:
Uncaught TypeError: Cannot read property 'helpers' of undefined
Pointing to the first couple of lines in the plugin code:
var Chart = window.Chart;
var helpers = Chart.helpers;
(Note that I don't even need to use the plugin (import 'chartjs-plugin-deferred'; for the error to appear; as soon as it's added to aurelia.json I get errors).
If I add a console.dir(window.Chart) before the lines that throw errors it is in fact not undefined, and if I try to use the plugin in my charts it actually works fine.
Can someone explain why this error occurs and if there's some way I can get rid of it? I feel uncomfortable shipping code that, while it works as it should, throws errors in the console.
I'm a huge fan of npm and imports etc but more often than not you run into issues such as these which imo is such a hassle and actually makes me miss the good old days of just piling script elements on top of each other.
Edit: I tried with a couple more plugins just to see if perhaps the deferred plugin was the issue here, but every other plugin I tried completely kills the build.
Does anyone have experience importing ChartJS and a ChartJS plugin into Aurelia successfully?
The issue at hand is that the library does not provide any meaningful way to jump in with a module loader and properly first fully load the dependency ChartJS before carrying on with the execution.
It would be the best if the library could wrap its code in a UMD compatible format to satisfy the most common formats at once, amongst those RequireJS, which is used for the Aurelia CLI.
I see you've created a Github Issue, including the libraries author as well. Good work, I've created a small PR to add the missing feature, which then also makes the example work, without throwing the missing helper error.

Qt Cross Application Styling Issues

I am writing PySide tools that run within other 3rd party applications. The same tool will run in multiple applications and should be styled consistently across these.
The problem I have is, these applications are sometimes using QT themselves and have their own styling, using presumably QPalette. When my tools parent to the main application they take on the main applications styling.
So I tried to solve this by using my own QPalette and setting my tools main window\widget to use it, however this doesn't have any effect on the widgets children and they still assume the styling from the main application (not sure if this is correct behaviour).
So I started using a stylesheet to customise the whole look, and largely this works. However it is still not consistent across applications. So either I am not overriding enough of the style sheet parameters or there are some things I cannot fix using the style sheet alone.
Example of same style sheet in Nuke and 3ds Max
The very basic stylesheet I used in the test:
QWidget {
margin: 0px;
padding: 0px;
spacing: 0px;
color:white;
}
My Concise Questions are:
Is it possible to completely override the appearance given by the QPalette using stylesheet alone?
If it is and its relevant here, what could I be missing, the spacing\size are different. Both windows are at their minimum size. Other than margin and padding, I can't think what would be effecting it.
note: I know I haven't overwritten the QGroupbox style sheet, and even doing so doesn't produce the same result. I have also tried using em, px and ex.
PySide version is 1.0.9 in nuke and 1.2.2 in max, if this makes a difference, and I guess it probably could.
Thanks
Unfortunately, due to historical reasons Qt does offer all too many ways to skin the same cat when it comes to widget styling, and the stylesheets don't affect layouts. Thus you can't describe an application's style completely using only QSS, and unless you're careful in your design, you'll end up styling things in all sorts of ways, especially if your code has a lot of history. That'll be the case with the tool you're building your plug-in for.
First and foremost, you've realized now that consistent styling is really an interface that all components must adhere to. If this interface is not specified in the plugin developer documentation for the plugin host application, it'll be ugly and unnecessarily hard.
The best you can do is iterate the application's other widgets and sniff their pallettes, layout spacings, etc. You'll basically have to hack it into a working shape, and hope that the next release of the host application doesn't break it. Since they don't specify anything in this respect, they themselves have nothing to test against nor develop against, so the expectation is that yes, it'll break, and yes, it'll be ugly. That's what you get when interface specification is ignored.

Automatic layout tests

Is there any tool for testing that layout for a website dont generate visual bugs?
Im working on a site where sometimes we can see visual bugs. Example:
There is a page where objects are listed. The listing is divided in pages.
Last time, after browsing a few page, I saw that a particular page showed a visual bug, in this case the table became wider than normally.
In this case the problem was that one of the td-tags contained too much text which made all the table become wider.
Maybe this can sound like a crazy thing? But my client thinks there is a way to set up this kind of tests and acording to him Jenkins can be used for this purpose.
There is a way to automate layout testing of a web application using Galen Framework. This tool has its own language and is very easy to learn and understand. It is a Selenium based and you can run test in Selenium Grid, Sauce Labs if you want to test your application in different browsers.
This tool gets the location of specified element on page and check them relatively to each other.
Example: if you want to check that menu pane is below header and stretches to the width of a browser and has 50 pixel height, you can do it like this:
menu
below: header 5px
width: 100% of screen/width
height: 50px
This tool can also be used to test responsive designs.
You can find complete documentation on official website http://galenframework.com
The best part is you can even create JAVA Tests. Galen JavaScript API is also available along with the sample projects in github.
Again, test(s) written once can be used at multiple phases of application lifecycle.

How to face many customer specific GUI variants, searching for alternative to Qt

we're maintaining some Qt applications which are running on Linux and Windows desktops. Now, we want to make the applications more attractive by adding customized forms and reports for each customer or at least groups of customers. There may be 10 or more different versions needed.
As we come from Qt, we are wondering how to manage so many configurations and if there already is a framework/development system that would help us here. We were looking at QML/Qt Quick, WT Toolkit or even NC Reports for the reporting part.
Managing configurations and deriving different versions from a base is not a feature which is discussed or promoted.
There should be a clean distinction between Display and Application Logic (Model/View)
Nice would be a textual GUI description, which enables us to release changes in forms or reports without the need to reinstall the whole applications (like QML seems to have that)
Also nice would be a kind of report generator, that helps to create forms and reports for new customers without the need to code them (and so releases our core developers from boring work)
Has somebody experience with such kind of customer based configurations? It would be nice to have a hint what's the best way to do this in the Qt surrounding.
I know comparisons like http://qt-project.org/doc/qt-5.1/qtdoc/topics-ui.html#comparison, but the specific questions that I have are not mentioned.
best regards
I guess you need to differentiate applications in three aspects:
1. appearance - if the application only differs in button color, icon image and background themes, qt's style sheet is light and convenient, you can choose to deploy different qss file and load different ones without recoding. if the variance among customers concerns layouts or available widgets (some has buttons, some use combo boxes, .etc), style sheet cannot meet the requirement, QML seems promising in such case.
business logic - i'm not sure how "generating reports" differs for different customers, if the reports need to be printed, or saved as document, i don't think qt provides good toolkit (QXXXDocument is not suitable to generate / display large amount of document), html? maybe. And i agree with #hyde that loading different plugins or dynamic libraries can solve this.
What I learnt from 8 month qt:
Model/View Architecture is there, for example a tree view that we fill with voyage data. the data is gatheres from several db tables, so we have a good logical distinction.
We hadn't the time to work us into qml, so we stuck with qt designer. It's quite easy, so we're fine with that. Delivering changes in customer forms without recompile will be a feature for a bigger future rework.
Same with report generators...

generate child pom dynamically

I have been wondering if it is possible to generate child poms dynamically (via XSLT or something similar) based upon a kind of feature model (http://en.wikipedia.org/wiki/Feature_model).
Not if you want them to be part of the reactor build.
The reactor (list of all projects and the plugins to run against them) must be complete and deterministic before any plugins start running.
This is why property substitution in (XPath) /project/parent/groupId, /project/parent/artifactId, /project/parent/version, /project/groupId, /project/artifactId, and /project/version are not permitted, as that would lead to a non-deterministic build plan.
However, if you want to create a bunch of projects via XSLT and then in a subsequent reactor (read Maven invocation) do stuff with them, that would work.
You could use Mojo's XML Maven Plugin to do the XSLT for you and then use the Maven Invoker Plugin to fork a new reactor but you will be in a sort half-way house and stuck with the lifecycle phases that you configure invoker with.