<commit_before>isis-wicket-wickedcharts
========================

An extension for [Apache Isis](http://isis.apache.org)' [Wicket viewer](http://isis.apache.org/components/viewers/wicket/about.html) with [Wicked Charts](https://code.google.com/p/wicked-charts/).  Wicked Charts is in turn an integration between [Apache Wicket](http://wicket.apache.org) and the [Highcharts](http://www.highcharts.com/) JS charting library).

*Any chart supported by Wicket Charts (see their [showcase](http://wicked-charts.appspot.com/) app) should work.*

### Screenshots

The following screenshots are based on simple action added to the app generated by Isis' [quickstart archetype](http://isis.apache.org/getting-started/quickstart-archetype.html).  See below for details.

Invoking an action:

![](https://raw.github.com/danhaywood/isis-wicket-wickedcharts/master/images/screenshot-1.png)

renders the returned chart:

![](https://raw.github.com/danhaywood/isis-wicket-wickedcharts/master/images/screenshot-2.png)



### Configuration

In your project's parent `pom.xml`, add to the `<dependencyManagement>` section:

    <dependencyManagement>
        <dependencies>
            ...
            <dependency>
                <groupId>com.danhaywood.isis.wicket.ui.components</groupId>
                <artifactId>danhaywood-isis-wicket-wickedcharts</artifactId>
                <version>1.0.0-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            ...
        </dependencies>
    </dependencyManagement>

In your project's DOM `pom.xml`, add a dependency on the `applib` module:

    <dependencies>
        ...
        <dependency>
            <groupId>com.danhaywood.isis.wicket.ui.components</groupId>
            <artifactId>danhaywood-isis-wicket-wickedcharts-applib</artifactId>
        </dependency>
        ...
    </dependencies> 


Finally, there is a required dependency in your project's webapp `pom.xml` to the `ui` module:

    <dependencies>
        ...
        <dependency>
            <groupId>com.danhaywood.isis.wicket.ui.components</groupId>
            <artifactId>danhaywood-isis-wicket-wickedcharts-ui</artifactId>
        </dependency>
        ...
    </dependencies> 


### Usage

This projects' applib module defines the `WickedChart` value type.  This is a simple wrapper around the Wicked Charts' project `Options` class.

Returning an instance of `WickedChart` from any action will render the chart.

For example, the screenshot above was generated using the following code (taken directly from the Wicked Charts' [getting started](https://code.google.com/p/wicked-charts/wiki/GettingStarted) page):

<pre>
public class ToDoItems {
    ...

    public WickedChart createChart() {
        Options options = new Options();

        options
            .setChartOptions(new ChartOptions()
                .setType(SeriesType.LINE));

        options
            .setTitle(new Title("My very own chart."));

        options
            .setxAxis(new Axis()
                .setCategories(Arrays
                    .asList(new String[] { "Jan", "Feb", "Mar", "Apr", "May",
                        "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" })));

        options
            .setyAxis(new Axis()
                .setTitle(new Title("Temperature (C)")));

        options
            .setLegend(new Legend()
                .setLayout(LegendLayout.VERTICAL)
                .setAlign(HorizontalAlignment.RIGHT)
                .setVerticalAlign(VerticalAlignment.TOP)
                .setX(-10)
                .setY(100)
                .setBorderWidth(0));

        options
            .addSeries(new SimpleSeries()
                .setName("Tokyo")
                .setData(
                    Arrays
                        .asList(new Number[] { 7.0, 6.9, 9.5, 14.5, 18.2, 21.5,
                            25.2, 26.5, 23.3, 18.3, 13.9, 9.6 })));

        options
            .addSeries(new SimpleSeries()
                .setName("New York")
                .setData(
                    Arrays
                        .asList(new Number[] { -0.2, 0.8, 5.7, 11.3, 17.0, 22.0,
                            24.8, 24.1, 20.1, 14.1, 8.6, 2.5 })));
        
        return new WickedChart(options);
    }

}
</pre><commit_msg>updating the README<commit_after>isis-wicket-wickedcharts
========================

An extension for [Apache Isis](http://isis.apache.org)' [Wicket viewer](http://isis.apache.org/components/viewers/wicket/about.html) with [Wicked Charts](https://code.google.com/p/wicked-charts/).  Wicked Charts is in turn an integration between [Apache Wicket](http://wicket.apache.org) and the [Highcharts](http://www.highcharts.com/) JS charting library).

*Any chart supported by Wicket Charts (see their [showcase](http://wicked-charts.appspot.com/) app) should work.*

### Screenshots

The following screenshots are based on simple action added to the app generated by Isis' [quickstart archetype](http://isis.apache.org/getting-started/quickstart-archetype.html).  See below for details.

Invoking an action:

![](https://raw.github.com/danhaywood/isis-wicket-wickedcharts/master/images/screenshot-1.png)

renders the returned chart:

![](https://raw.github.com/danhaywood/isis-wicket-wickedcharts/master/images/screenshot-2.png)



### Configuration

In your project's parent `pom.xml`, add to the `<dependencyManagement>` section:

    <dependencyManagement>
        <dependencies>
            ...
            <dependency>
                <groupId>com.danhaywood.isis.wicket.ui.components</groupId>
                <artifactId>danhaywood-isis-wicket-wickedcharts</artifactId>
                <version>1.0.0-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            ...
        </dependencies>
    </dependencyManagement>

In your project's DOM `pom.xml`, add a dependency on the `applib` module:

    <dependencies>
        ...
        <dependency>
            <groupId>com.danhaywood.isis.wicket.ui.components</groupId>
            <artifactId>danhaywood-isis-wicket-wickedcharts-applib</artifactId>
        </dependency>
        ...
    </dependencies> 


Finally, there is a required dependency in your project's webapp `pom.xml` to the `ui` module:

    <dependencies>
        ...
        <dependency>
            <groupId>com.danhaywood.isis.wicket.ui.components</groupId>
            <artifactId>danhaywood-isis-wicket-wickedcharts-ui</artifactId>
        </dependency>
        ...
    </dependencies> 


### Usage

This projects' applib module defines the `WickedChart` value type.  This is a simple wrapper around the Wicked Charts' project `Options` class.

Returning an instance of `WickedChart` from any action will render the chart.

For example, the screenshot above was generated using the following code (taken directly from the Wicked Charts' [getting started](https://code.google.com/p/wicked-charts/wiki/GettingStarted) page):

<pre>
public class ToDoItems {
    ...

    public WickedChart createChart() {
        Options options = new Options();

        options
            .setChartOptions(new ChartOptions()
                .setType(SeriesType.LINE));

        options
            .setTitle(new Title("My very own chart."));

        options
            .setxAxis(new Axis()
                .setCategories(Arrays
                    .asList(new String[] { "Jan", "Feb", "Mar", "Apr", "May",
                        "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" })));

        options
            .setyAxis(new Axis()
                .setTitle(new Title("Temperature (C)")));

        options
            .setLegend(new Legend()
                .setLayout(LegendLayout.VERTICAL)
                .setAlign(HorizontalAlignment.RIGHT)
                .setVerticalAlign(VerticalAlignment.TOP)
                .setX(-10)
                .setY(100)
                .setBorderWidth(0));

        options
            .addSeries(new SimpleSeries()
                .setName("Tokyo")
                .setData(
                    Arrays
                        .asList(new Number[] { 7.0, 6.9, 9.5, 14.5, 18.2, 21.5,
                            25.2, 26.5, 23.3, 18.3, 13.9, 9.6 })));

        options
            .addSeries(new SimpleSeries()
                .setName("New York")
                .setData(
                    Arrays
                        .asList(new Number[] { -0.2, 0.8, 5.7, 11.3, 17.0, 22.0,
                            24.8, 24.1, 20.1, 14.1, 8.6, 2.5 })));
        
        return new WickedChart(options);
    }

}
</pre>

While the demo shows a simple line graph, any chart supported by Wicket Charts (see their [showcase](http://wicked-charts.appspot.com/) app) should work.
{'fraction_non_alphanumeric': 0.13268902785673678, 'fraction_numerical': 0.016827743035815804, 'mean_word_length': 2.085233251490705, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 73, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4163393', 'n_tokens_mistral': 2836, 'n_tokens_neox': 2518, 'n_words': 589}