Giter Club home page Giter Club logo

chartjs's Introduction

Mendix ChartJS widget Support

This widget is a wrapper for the ChartJS library and you can use it to visualize your aggregated data.

Available charts
Multi Series Single Series
Bar Pie
Stacked Bar Doughnut
Line Polar
Radar

With the multi-series, one dataset, with its own color and label, has multiple data points.

In the single series, each dataset only contains one value.

Contributing

For more information on contributing to this repository visit Contributing to a GitHub repository!

Configuration

The data for this widget is retrieved through a datasource microflow. The assumption here is that all aggregation of data is done in the microflow and non-persistent objects are sent back to the widget.

In a nutshell, an implementation of the ChartJS widget consists of the following steps:

  1. The widget invokes the datasource microflow returning a (chart entity) object to the widget.
  2. The (chart) object that is returned should have dataset objects associated to it. In case of a multi series chart, a dataset should have datapoint objects associated to the dataset.
  3. The widget uses this data to render the chart.

We suggest using one the following domain models, depending on which chart(s) you would like to implement. You can create your own implementation as long as it matches the widget's datasource requirements.

Single Serie Datamodel suggested for use with the widget

Multi Series Datamodel suggested for use with the widget

Considering a line chart, one dataset object represents one line. A line is drawn up out of of several datapoint objects.

Setting up a single serie chart works best if you configure the properties in the following order:

1) Data Source

The data source for all charts in this widget package is a chart entity object returned by a microflow.

  • Chart Entity - Container entity, referencing Dataset entity objects. SingleSerieChart or MultiSeriesChart in our example.
  • Microflow - The datasource microflow that returns an object of the same entity as the Chart entity.
  • Total value - Optional: Renders an additional (unstyled)HTML element containing the value of the configured attribute.
2) Data Set

At least one dataset object should be associated to the chart entity object.

In case of a pie/doughnut/polar chart, a dataset object represents one "slice" (or sector) and consist of a 'label' and a 'value'.

For a line, (stacked) bar or radar chart, a dataset object represents a container for a serie of datapoints. A chart can have multiple datasets(series).

  • Data Set Entity - The reference set that connects the Chart Entity to Data Set or Data Set Series entity.
  • Label - Caption for sector (single serie) or serie (multi series) charts
  • Sorting - Attribute of which the value will be used to determine the ascending sort order.
  • Fill color (in Hex) - Attribute of which the value will be used to set the fill color in hex.
  • Highlight color (in Hex) - Optional: Attribute of which the value will be used to set the highlight color in hex. Default: fill color
  • Reduce opacity - Adds transparency to the fill color(opacity:0.5) and highlight color(opacity:0.75)
3) Data Point (Multi series charts only)

At least one datapoint object should be associated to every dataset object. In case of a line chart, all datapoints together will make up for one line. In case of a bar chart, each datapoint in a serie(dataset object) will be represented by one bar. A serie(dataset) can have multiple bars(datapoints).

  • Data Point Entity - Entity containing the values.
  • X Value - The attribute that contains the X value for the data point.
  • X Sorting - Attribute of which the value will determine how the datapoint will be ordered in relation to other datapoints.
  • Y Value - The attribute that contains the Y value for the data point.

Behavior

Onclick microflow

This microflow is executed when any part of the actual chart (not the legend) is clicked and passes the dataview context object along.

(Chart specific) Settings

All the settings for this widget match the original ChartJS settings. The documentation for these can be found here: ChartJS Documentation.

chartjs's People

Contributors

andries-smit avatar cdcharlebois avatar chrisdeg avatar criccle avatar gredens avatar hnejra avatar jeltemx avatar mcpoowl avatar melvingrootenboers avatar pimvdnoll avatar roelandsalij avatar rvthof avatar tieniber avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chartjs's Issues

Bar chart disappears when page is resized

I noticed that my bar chart disappears when the page is resized, the chart is responsive, but instead of adjusting to the size of the screen, the chart disappears completely, is anyone else having any issues with this?

chart is flickering while the mouse is hovering over it

I haven't got any response or comment on stackoverflow so I'd like to ask it here too to have your view on this issue. Am I doing something wrong or this is really an issue? (See: http://stackoverflow.com/questions/28609932/chartjs-resizing-very-quickly-flickering-on-mouseover )

I have a chart in a bootstrap-based page and I'm trying to resize it when the page gets resized, to follow the changes of the responsive design. So I have this piece of code:

function redrawChart() {
    var w = $("#chart_container").width();
    var c = document.getElementById("chart_canvas");
    c.width = w;
    c.height = w/2;
    $("#chart_canvas").css("width", w);
    $("#chart_canvas").css("height", w/2);

    var chart_canvas = document.getElementById("chart_canvas").getContext("2d");
    var line_chart= new Chart(chart_canvas).Line(data, options);
};

redrawChart();

var resizeTimer; 

$(window).resize(function() {
    clearTimeout(resizeTimer);
    resizeTimer = setTimeout(redrawChart, 250);
});

So redrawChart is called once when the page is loaded and then with every page resize.

Symptoms: when the page is loaded, everything works perfectly as long as it's not resized. After a resize, the chart flickers, gets resized very quickly when the mouse is hovering over it. By this I mean that with the smallest move of the cursor different sizes of the chart as a picture are loaded to the canvas. Like if from a cache or something. I suspect that the different sizes are the ones that the cart was resized to when resizing the window and they are coming back depending on the mouse position. Chart-images are loaded to the upper left corner and when a smaller image is loaded, the canvas is not cleared so the larger images remain visible.

The main reason I think these are images is that I use transparent background for the chart but when a smaller one is loaded on the canvas, the transparent part looks as if nothing is beneath that, however there is, the larger chart, previously drawn. But I might be wrong.

Any idea what causes this?

donut charts don't display

The donut chart doesn't display. Changing configuration settings didn't work to get any different result.

How to set formatting on values?

In my microflow I format the values (for example the legenda) with formatFloat($SumVar,'#,###')
. The result is 32.932.222 (32 million) but is shown as 32,932.222.
Is it possible to set the locale or somehing on the chart? My project language is in NL_nl (user lang also)

Two bar charts are drawn when I refresh object

Whenever I use a microflow to change or refresh the object that feeds in the data to the chart, the chart draws two instances of itself on the canvas. If I refresh it again, it draws three, and it continues in that sequence. I would like for it to redraw the chart over instead of drawing more instances of itself. Does anyone know how I wold accomplish this?

Highlighting on line chart

When i highlight over a data point on the line chart it currently brings up a label that is not for the correct month. For example you highlight February and January figure comes up.

Stacked bar chart: Order of stacking

The stacked bars aren't in the right order. I expect that the first dataset (sequence 1) is at the bottom and the next dataset above it. And so on, and so on.
Now the order isn't always stable and the order way around.

Radar charts always filled

Greetings,

I'm trying to use the datasetFill option for radar charts and set it to no filling; however, when I set the datasetFill option to no, the chart is always filled. This option works for line charts but not for radar charts. Is this an issue with the widget or does it have anything to do with chartjs? Thank you for your help.

Empty dataset

A chart will have multiple dataset, but sometimes the dataset won't have any datapoints. At this moment the widget will crash because the widgets tries to retrieve null id's from the app.

Height and width aren't set on the canvas

In the properties of the widget you can set custom height and width, but those settings aren't set on the canvas of the widget. The height and width on the canvas are preset on the template of the widget. The responsive is set on No.

Polar Charts not rendering at proper size

In the testing project, the Polar Chart type is not rendering at a proper size on the canvas. The chart ends up looking very small, especially when comparing with pie and donut. The chart is not usable in its current form in a project.
size issue

Refresh of data

When the 'Chart' object is refreshed from a microflow, the chart needs to pull the chart data again and draw the chart again.

Line chart: Empty values are rendered as 0

We would like empty values in the data points to not show, instead of 0 as a value. This would be a more correct representation of our data (data points with 0 might be correct measurements. empty data points mean the measurement is missing).

The simpleChart widget used to handle it this way.

According to http://stackoverflow.com/questions/30462042/line-chartjs-empty-null-values-doesnt-break-the-line/30478786#30478786 it should be possible with ChartJS.

[Doughnut] Disabling a slice doesn't refresh

When I disable a slice in the legend it doesn't refresh the object, causing the disabled slice to remain visible. This feature DOES work in the Pie chart

Banana slice is disabled, but still visible (donut)
image

Software slice is disabled and no longer visible in the chart (pie)
image

(Double) doughnut max/min Y value

The both widgets doughnut and double doughnut has the properties 'Minimum value Y axis' and 'Maximum value Y axis'. For the both widgets there is an option X value and Y value for the single datapoint.
Those properties are irrelevant.

Legend is drawn twice

With the new ChartJS library, the chartLegend is drawn twice:

  1. according to the legend template (this will show below the widget)
  2. according to the chartJS legend (this will show above the widget)

image

Disabling the legend in the widget will draw only one legend, namely the legend from ChartJS itself.

In short, a few things:

  1. Two legends
  2. disable legend in widget will disable only one (the bottom, widget, one)
  3. rendering of widget legend is really messy.
  4. Using the widget legend to disable datasets, doesn't use the animation

In my opinion, the template should be deleted, and we should use the ChartJS default template, and let the showLegend boolean disable thát legend.

If that is the way to go, I'd like to see an attribute where I can set the font family, or automatically let it use the font from my application. It defaults to Helvetica now.

Feature: graph colors

Within 360 there are colors for each type of data. The colors are created based RGBA. At this moment I'm missing to set the alpha value because of the colors are in RGB. Is there a solution to set the alpha value? Or as a separate optional property.

Line Chart w/multiple data sets - tooltip does not align with cursor.

When more than 1 data set exists (and thus multiple lines), the tooltip that is rendered on the chart canvas does not align with the user's mouse / cursor. It is typically a 2 points to the left of where the user would like the tooltip to be. See attached image for more details.

Please not that the tooltip displays correctly when there is only 1 data set (or the other data sets have been de-selected).

Thank you!

chartjs_cursor

Can't see all options at my resolution

Dear ChartJs devteam,

I seem to be missing the "Maintain aspect ratio" option on my BarChart settings due to my resolution. Is it possible to make the screen scroll when dealing with different resolutions?

capture

Many thanks,

R. Somers

LineChart breziercurve isn't working

Selecting whether the line in a linechart should be curved, doesn't do anything.

I have the boolean set to no, but the line is still curved.

The settings Brezier Curve and Brezier Curve Tension don't seem to do anything

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.