Giter VIP home page Giter VIP logo

vaadin-chartjs's People

Contributors

gokhanoner avatar kegoe avatar micw avatar razvanml avatar slatequarry avatar

Stargazers

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

Watchers

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

vaadin-chartjs's Issues

Element configuration

http://www.chartjs.org/docs/#chart-configuration-element-configuration

  window.onload = function() {
            var ctx = document.getElementById("canvas").getContext("2d");
            window.myBar = new Chart(ctx, {
                type: 'bar',
                data: barChartData,
                options: {
                    // Elements options apply to all of the options unless overridden in a dataset
                    // In this case, we are setting the border of each bar to be 2px wide and green
                    elements: {
                        rectangle: {
                            borderWidth: 2,
                            borderColor: 'rgb(0, 255, 0)',
                            borderSkipped: 'bottom'
                        }
                    },
                    responsive: true,
                    legend: {
                        position: 'top',
                    },
                    title: {
                        display: true,
                        text: 'Chart.js Bar Chart'
                    }
                }
            });

        };

Chart image download

A user wants to download the current chart by clicking a button (vaadin button).

It looks like I have to call a js function on the connector using com.vaadin.ui.AbstractJavaScriptComponent.callFunction(String, Object...) and then call the server with a function registered by com.vaadin.ui.AbstractJavaScriptComponent.addFunction(String, JavaScriptFunction)

I havenot found a method, which can retrieve the return value of a javascript function.

Resources:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL
https://github.com/chartjs/Chart.js/search?utf8=%E2%9C%93&q=toBase64Image

    this.getImageDataUrl= function() {
         // call on function registered by server side component
         self.sendImageDataUrl(chartjs.toBase64Image());
    }

Demo server does not work anymore

I think Vaadin and Jelastic ended their cooperation for addon devs because there isn't anything on this cooperation on Vaadin's website anymore.

Chart size problem

When set the chart size using setSizeFull(), i expect to see the chart sized correctly, but instead it overflows and some part is not seen on the screen.

Resolve configuration to json in attach()

If I construct the ChartJs component on init of the view using @PostConstruct (Vaadin Spring). I'm not able to add Datasets when the actual data is availiable.

Therefore the configuration will be resolve in the components attach() method.

Furthermore I added a default constructor for ChartJs and configure method to set the ChartConfig implementation.

Stretched chart after refreshData()

When I trigger refreshData() chart is is stretched.
Browser refresh, browser resize ... all is perfect.

What am I dooing wrong?

Vaadin 7.7.9
vaadin-chartjs 0.4.0

A bit of source code

   private void buildChart() {
           
      configChart = new LineChartConfig();
      
      configChart.data()
              .addDataset(new LineDataset().label("qwerty").backgroundColor("rgba(151,187,145,0.5)"))
              .and()
              .options()
              .responsive(true)
              .title()
              .display(true)
              .and()
              .tooltips()
              .and()
              .scales()
              .add(Axis.X, new DefaultScale()
                      .stacked(true))
              .add(Axis.Y, new DefaultScale()
                      .stacked(true))
              .and()
              .done();

      
      
      Dataset<?, ?> ds = configChart.data().getDatasetAtIndex(0);
      chartLineDataSet = (LineDataset) ds;
      
      
      chart = new ChartJs(configChart);
      chart.setJsLoggingEnabled(true);
      chart.setSizeFull();
   }

   private void chartDataRefresh(Long offset) {
      dataSNR = crDrI122Repo.getAllSnrs();
      
      dataTaskDateString = Util.dateArrayToStringarray(crDrI122Repo.getAllTaskDates());
      configChart.data().labels(dataTaskDateString);

      chartLineDataSet.dataAsList(Util.floatListToDoubleList(dataSNR));
      
      chart.configure(configChart);
      chart.refreshData();
      
   }

OK
huberto_awtfm_agfapoland_2017-06-10_18-32-19

after reload
huberto_awtfm_agfapoland_2017-06-10_18-33-12

ps. vaadin chart js = great job

Prepare Release 1.0.0

  • Write release notes
  • Setup up Patreon page
  • Publish Patreon page
  • Deploy demo
  • Release addon to bintray
  • Publish in Vaadin directory

Question about ChartUtils

Hello, First of all a BIG thank you for the add-on. It is Great.

I have one question, where I can find the "ChartUtils", where are included. I can import all the libraries
except this one.

Thanks again
Elias

Use Vaadin Chartjs on a HA environment

HI,

When trying to deploy an application on a HA environment, Vaadin-Chartjs configuration objects complain about non-serializable objects.

Caused by: org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: com.byteowls.vaadin.chartjs.config.BarChartConfig
	at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:68) ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:35) ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.serialize(JdkSerializationRedisSerializer.java:90) ~[spring-data-redis-1.7.7.RELEASE.jar:na]
	... 38 common frames omitted
Caused by: java.io.NotSerializableException: com.byteowls.vaadin.chartjs.config.BarChartConfig
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) ~[na:1.8.0_121]
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548) ~[na:1.8.0_121]
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509) ~[na:1.8.0_121]
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) ~[na:1.8.0_121]
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) ~[na:1.8.0_121]
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) ~[na:1.8.0_121]
	at java.util.HashMap.internalWriteEntries(HashMap.java:1784) ~[na:1.8.0_121]
	at java.util.HashMap.writeObject(HashMap.java:1362) ~[na:1.8.0_121]
	at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source) ~[na:na]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028) ~[na:1.8.0_121]
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496) ~[na:1.8.0_121]
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) ~[na:1.8.0_121]
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) ~[na:1.8.0_121]
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548) ~[na:1.8.0_121]
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509) ~[na:1.8.0_121]

Is the system prepared for view serialization ?

Spring Boot Demo

Base the demo on spring boot because its easier to debug and develop.

"Maximum call stack size exceeded" when ?debug console is enabled

ChartJsWidgetset-0.js:21863 Sun Jul 31 20:54:08 GMT+200 2016 com.vaadin.client.ApplicationConfiguration
SEVERE: (RangeError) : Maximum call stack size exceededcom.google.gwt.core.client.JavaScriptException: (RangeError) : Maximum call stack size exceeded
    at Unknown.emptyMethod(ChartJsWidgetset-0.js)
    at Unknown.hasTypeMarker(ChartJsWidgetset-0.js)
    at Unknown.hasJavaObjectVirtualDispatch(ChartJsWidgetset-0.js)
    at Unknown.$init__V__devirtual$(ChartJsWidgetset-0.js)
    at Unknown.Object_0(ChartJsWidgetset-0.js)
    at Unknown.AbstractMap(ChartJsWidgetset-0.js)
    at Unknown.AbstractHashMap(ChartJsWidgetset-0.js)
    at Unknown.HashMap(ChartJsWidgetset-0.js)
    at Unknown.$init_257(ChartJsWidgetset-0.js)
    at Unknown.SimpleEventBus_0(ChartJsWidgetset-0.js)
    at Unknown.HandlerManager$Bus(ChartJsWidgetset-0.js)
    at Unknown.HandlerManager_0(ChartJsWidgetset-0.js)
    at Unknown.HandlerManager(ChartJsWidgetset-0.js)
    at Unknown.createHandlerManager(ChartJsWidgetset-0.js)
    at Unknown.ensureHandlers(ChartJsWidgetset-0.js)
    at Unknown.addDomHandler(ChartJsWidgetset-0.js)
    at Unknown.SimpleTree(ChartJsWidgetset-0.js)
    at Unknown.SimpleTree_0(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_1(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_1(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_1(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_1(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_1(ChartJsWidgetset-0.js)
    at Unknown.dir_3(ChartJsWidgetset-0.js)
    at Unknown.dir_2(ChartJsWidgetset-0.js)

Extract data labels from actual dataset

If I want to show the status feedback of a transactional email service like Amazon's SES in a chart I could either create a separate chart data structure, run through the list of feedback objects and extract the labels from there or integrate some helpers to the addon:

Advise the addon to extract labels from the first dataset:

    DonutChartConfig config = new DonutChartConfig();
    config.data()
       .extractLabelsFromDataset(true)
       .addDataset(dataset);

We create a donut chart config and adivse the chart to extractLabelsFromDataset(true) as soon as the datasets are send to the client side.

Dynamically create a dataset labels

    PieDataset dataset = new PieDataset();
   // dataset.randomBackgroundColors(true);

    String successfullSent = i18n.get("messaging.status.feedback.success");
    for (EmailFeedback f : feedbackList) {
      String desc = f.getFeedbackDescription();
      if (desc == null) {
        desc = successfullSent;
      }
      dataset.addLabeledData(desc, 1d);
    }

Using dataset.addLabeledData(labelName, value); the value will be added to a"label-value map". In case of double data based dataset (like Bar, Line, Polar, Radar and Pie) the value will be added to a existing value and does not replace it.

Make contributing to the project easier

Right now there these problems:

  • BINTRAY properties are required. For future use with TravisCI use the solution in jopencage.
  • Gradle Vaadin Plugin pulls in jetty which prevents the spring boot app demo to start.
    Currently I commented the gradle-vaadin-plugin section in demo/build.gradle. The commenting might cause the problems in #11
  • Right now developing vaadin addons only works with Eclipse and the Gradle IDE (http://dist.springsource.com/release/TOOLS/update/e4.6/)
  • Add step by step setup to contribute section in readme.
  • I would like to develop in IDEA myself but was not able to get the Gradle multiproject running

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.