Skip to content

Commit

Permalink
public repository
Browse files Browse the repository at this point in the history
  • Loading branch information
gianpiero.di.blasi authored and gianpiero.di.blasi committed May 21, 2022
1 parent c7258f9 commit 0e5b0ea
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 214 deletions.
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org>
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# RadarChartWidget
An extension to show a radar chart.

## Description
This extension provides a widget to show a radar chart based on the chart.js library (see dependencies). The chart is described by the ds_RadarChartData DataShape for data and the ds_RadarChartDataSettings for settings (see below); the DataShape structures are mandatory, but they can be extended with additional fields.

## Properties
- debugMode - BOOLEAN (default = false): if set to true it sends to the browser's JS console a set of information useful for debugging the widget
- data - INFOTABLE (no default value): the data to show (use or duplicate & extend the Data Shape ds_RadarChartData, see below)
- dataSettings - INFOTABLE (no default value): the settings of the data (use or duplicate & extend the Data Shape ds_RadarChartDataSettings, see below)
- beginAtZero - BOOLEAN (default = true): if true, scale will include 0 if it is not already included
- minValue - NUMBER (default = 0): the minimum value
- maxValue - NUMBER (default = 100): the maximum value
- stepSize - NUMBER (default = 20): the step size between min and max
- fontSize - NUMBER (default = 12): the font size
- pointRadius - NUMBER (default = 3): the radius of the point shape
- pointBorderWidth - NUMBER (default = 1): the width of the point border
- pointHoverRadius - NUMBER (default = 4): the radius of the point when hovered
- legendPosition - STRING (default = 'top'): the (optional) legend position (options: NO_LEGEND, top, left, right, bottom

## Services
- Render: service to render the chart

## DataShapes
- ds_RadarChartData
- dataset: the dataset name - STRING
- field: the field name - STRING
- value: the field value - NUMBER
- ds_RadarChartDataSettings
- dataset: the dataset name - STRING
- backgroundColor: the background color - STRING
- borderColor: the border color - STRING
- pointBackgroundColor: the background color of the point - STRING
- pointBorderColor - the border color of the point - STRING

## Dependencies
chart.js - [link](https://github.com/chartjs/Chart.js)

## Donate
If you would like to support the development of this and/or other extensions, consider making a [donation](https://www.paypal.com/donate/?business=HCDX9BAEYDF4C&no_recurring=0&currency_code=EUR).
294 changes: 115 additions & 179 deletions build-extension.xml
Original file line number Diff line number Diff line change
@@ -1,180 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="RadarChartWidget" basedir="." default="build">

<property name="extension.jar" value="radarchartwidget.jar" />

<property name="target" value="1.8" />
<property name="source" value="1.8" />
<property name="debuglevel" value="source,lines,vars" />
<property name="common" value="common" />
<property name="ui" value="ui" />
<property name="lib" value="lib" />
<property name="entities" value="Entities" />
<property name="localization" value="Localization" />
<property name="src.dir" value="${basedir}/src" />
<property name="build.dir" value="${user.home}/builds/${ant.project.name}/bin" />
<property name="minify.dir" value="${user.home}/builds/${ant.project.name}/minify" />
<property name="custom.dir" value="${user.home}/builds/${ant.project.name}/custom" />
<property name="config.dir" value="${basedir}/configfiles" />
<property name="ui.dir" value="${basedir}/${ui}" />
<property name="lib.dir" value="${basedir}/${lib}" />
<property name="zip.dir" value="${user.home}/builds/${ant.project.name}/build/distributions" />
<property name="entity.dir" value="${basedir}/Entities" />
<property name="localization.dir" value="${basedir}/${localization}" />

<property file="${user.home}/vendor-custom.txt"/>
<property file="extension.properties" />

<!-- ExtensionPackage directory structure props -->
<property name="package.lib.basedir" value="${lib}" />
<property name="package.ui.basedir" value="${ui}" />
<property name="package.common.lib.dir" value="${package.lib.basedir}/${common}" />
<property name="package.common.ui.dir" value="${package.ui.basedir}/${common}" />

<!-- Extension file info -->
<property name="zip.file.name" value="${ant.project.name}.zip" />
<property name="minify-zip.file.name" value="${ant.project.name}-min.zip" />
<property name="minify-custom-zip.file.name" value="${ant.project.name}-min-custom.zip" />

<tstamp>
<format property="NOW" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>

<!-- define the classpath so it picks up the ThingWorx SDK jar relative to this basedir -->
<path id="jar.classpath">
<pathelement location="${build.dir}" />
<fileset dir="${basedir}/twx-lib" includes="*.jar" />
<fileset dir="${lib.dir}" includes="*.jar" erroronmissingdir="false" />
</path>

<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${zip.dir}" />
<delete dir="${minify.dir}" />
<delete dir="${custom.dir}" />
</target>

<target name="init" depends="clean">
<mkdir dir="${build.dir}" />

<copy includeemptydirs="false" todir="${build.dir}">
<fileset dir="${src.dir}">
<exclude name="**/*.launch" />
<exclude name="**/*.java" />
</fileset>
</copy>
</target>

<target name="build-source" depends="init">
<echo message="${ant.project.name}: ${ant.file}" />
<javac debug="true" debuglevel="${debuglevel}" destdir="${build.dir}" source="${source}" target="${target}" includeantruntime="false">
<src path="${src.dir}" />
<classpath refid="jar.classpath" />
</javac>
</target>

<target name="check-bin" depends="build-source">
<fileset dir="${build.dir}" id="binfileset" />
<condition property="bindir.empty">
<length length="0">
<fileset refid="binfileset" />
</length>
</condition>
</target>

<target name="build-jars" depends="check-bin" unless="bindir.empty">
<echo message="building ${extension.jar} to ${build.dir}..." />
<jar destfile="${build.dir}/${extension.jar}">
<!-- generate MANIFEST inline -->
<manifest>
<attribute name="Built-By" value="Eclipse Plugin for ThingWorx Extension Development ${twx_eclipse_plugin_version}" />
<attribute name="Build-Date" value="${NOW}" />
<section name="${ant.project.name}">
<attribute name="Package-Title" value="${ant.project.name}" />
<attribute name="Package-Version" value="${package_version}" />
<attribute name="Package-Vendor" value="${project_vendor}" />
</section>
</manifest>

<fileset dir="${build.dir}" />
</jar>
</target>

<target name="copy-minify">
<copy todir="${minify.dir}">
<fileset dir="${basedir}" includes="${ui}/**/*.min.*" excludes="${ui}/**/jslibrary/*.*"/>
<fileset dir="${basedir}" includes="${ui}/**/*.png" />
</copy>

<move todir="${minify.dir}">
<fileset dir="${minify.dir}" includes="${ui}/**/*.min.*" />
<mapper>
<mapper type="regexp" from="(.*).min.(.*)" to="\1.\2" />
</mapper>
</move>
</target>

<target name="metadata-custom">
<copy todir="${custom.dir}">
<fileset dir="${config.dir}" includes="metadata.xml" />
</copy>

<replace file="${custom.dir}/metadata.xml" token="Accenture Italy - Industry X" value="${vendor-custom}"/>
</target>

<target name="package-extension" depends="build-jars">
<zip destfile="${zip.dir}/${zip.file.name}">
<mappedresources>
<fileset dir="${build.dir}" includes="${extension.jar}" />
<globmapper from="*" to="${package.common.lib.dir}/*" />
</mappedresources>

<zipfileset dir="${config.dir}" includes="metadata.xml" />

<zipfileset dir="${basedir}" includes="${entities}/**/*.xml" />
<zipfileset dir="${basedir}" includes="${localization}/**/*.json" />
<zipfileset dir="${basedir}" includes="${ui}/**/*.*" excludes="${ui}/**/*.min.*,${ui}/**/jslibrary/*.*" />
<zipfileset dir="${basedir}" includes="${ui}/**/jslibrary/*.*" />
<zipfileset dir="${lib.dir}" includes="**/*.jar" prefix="${package.common.lib.dir}/"/>
</zip>
</target>

<target name="package-extension-minify" depends="build-jars,copy-minify">
<zip destfile="${zip.dir}/${minify-zip.file.name}">
<mappedresources>
<fileset dir="${build.dir}" includes="${extension.jar}" />
<globmapper from="*" to="${package.common.lib.dir}/*" />
</mappedresources>

<zipfileset dir="${config.dir}" includes="metadata.xml" />

<zipfileset dir="${basedir}" includes="${entities}/**/*.xml" />
<zipfileset dir="${basedir}" includes="${localization}/**/*.json" />
<zipfileset dir="${minify.dir}" includes="**/*.*" />
<zipfileset dir="${basedir}" includes="${ui}/**/jslibrary/*.*" />
<zipfileset dir="${lib.dir}" includes="**/*.jar" prefix="${package.common.lib.dir}/"/>
</zip>
</target>

<target name="package-extension-minify-custom" depends="build-jars,copy-minify,metadata-custom">
<zip destfile="${zip.dir}/${minify-custom-zip.file.name}">
<mappedresources>
<fileset dir="${build.dir}" includes="${extension.jar}" />
<globmapper from="*" to="${package.common.lib.dir}/*" />
</mappedresources>

<zipfileset dir="${custom.dir}" includes="metadata.xml" />

<zipfileset dir="${basedir}" includes="${entities}/**/*.xml" />
<zipfileset dir="${basedir}" includes="${localization}/**/*.json" />
<zipfileset dir="${minify.dir}" includes="**/*.*" />
<zipfileset dir="${basedir}" includes="${ui}/**/jslibrary/*.*" />
<zipfileset dir="${lib.dir}" includes="**/*.jar" prefix="${package.common.lib.dir}/"/>
</zip>
</target>

<target name="build" depends="package-extension,package-extension-minify,package-extension-minify-custom">
<echo message="Building ${ant.project.name} extension package..."/>
</target>

<?xml version="1.0" encoding="UTF-8"?>
<project name="RadarChartWidget" basedir="." default="build">

<property name="extension.jar" value="radarchartwidget.jar" />

<property name="target" value="1.8" />
<property name="source" value="1.8" />
<property name="debuglevel" value="source,lines,vars" />
<property name="common" value="common" />
<property name="ui" value="ui" />
<property name="lib" value="lib" />
<property name="entities" value="Entities" />
<property name="localization" value="Localization" />
<property name="src.dir" value="${basedir}/src" />
<property name="build.dir" value="${user.home}/builds/${ant.project.name}/bin" />
<property name="config.dir" value="${basedir}/configfiles" />
<property name="ui.dir" value="${basedir}/${ui}" />
<property name="lib.dir" value="${basedir}/${lib}" />
<property name="zip.dir" value="${user.home}/builds/${ant.project.name}/build/distributions" />
<property name="entity.dir" value="${basedir}/Entities" />
<property name="localization.dir" value="${basedir}/${localization}" />

<property file="extension.properties" />

<!-- ExtensionPackage directory structure props -->
<property name="package.lib.basedir" value="${lib}" />
<property name="package.ui.basedir" value="${ui}" />
<property name="package.common.lib.dir" value="${package.lib.basedir}/${common}" />
<property name="package.common.ui.dir" value="${package.ui.basedir}/${common}" />

<!-- Extension file info -->
<property name="zip.file.name" value="${ant.project.name}.zip" />

<tstamp>
<format property="NOW" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>

<!-- define the classpath so it picks up the ThingWorx SDK jar relative to this basedir -->
<path id="jar.classpath">
<pathelement location="${build.dir}" />
<fileset dir="${basedir}/twx-lib" includes="*.jar" />
<fileset dir="${lib.dir}" includes="*.jar" erroronmissingdir="false" />
</path>

<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${zip.dir}" />
</target>

<target name="init" depends="clean">
<mkdir dir="${build.dir}" />

<copy includeemptydirs="false" todir="${build.dir}">
<fileset dir="${src.dir}">
<exclude name="**/*.launch" />
<exclude name="**/*.java" />
</fileset>
</copy>
</target>

<target name="build-source" depends="init">
<echo message="${ant.project.name}: ${ant.file}" />
<javac debug="true" debuglevel="${debuglevel}" destdir="${build.dir}" source="${source}" target="${target}" includeantruntime="false">
<src path="${src.dir}" />
<classpath refid="jar.classpath" />
</javac>
</target>

<target name="check-bin" depends="build-source">
<fileset dir="${build.dir}" id="binfileset" />
<condition property="bindir.empty">
<length length="0">
<fileset refid="binfileset" />
</length>
</condition>
</target>

<target name="build-jars" depends="check-bin" unless="bindir.empty">
<echo message="building ${extension.jar} to ${build.dir}..." />
<jar destfile="${build.dir}/${extension.jar}">
<!-- generate MANIFEST inline -->
<manifest>
<attribute name="Built-By" value="Eclipse Plugin for ThingWorx Extension Development ${twx_eclipse_plugin_version}" />
<attribute name="Build-Date" value="${NOW}" />
<section name="${ant.project.name}">
<attribute name="Package-Title" value="${ant.project.name}" />
<attribute name="Package-Version" value="${package_version}" />
<attribute name="Package-Vendor" value="${project_vendor}" />
</section>
</manifest>

<fileset dir="${build.dir}" />
</jar>
</target>

<target name="package-extension" depends="build-jars">
<zip destfile="${zip.dir}/${zip.file.name}">
<mappedresources>
<fileset dir="${build.dir}" includes="${extension.jar}" />
<globmapper from="*" to="${package.common.lib.dir}/*" />
</mappedresources>

<zipfileset dir="${config.dir}" includes="metadata.xml" />

<zipfileset dir="${basedir}" includes="${entities}/**/*.xml" />
<zipfileset dir="${basedir}" includes="${localization}/**/*.json" />
<zipfileset dir="${basedir}" includes="${ui}/**/*.*" />
<zipfileset dir="${lib.dir}" includes="**/*.jar" prefix="${package.common.lib.dir}/"/>
</zip>
</target>

<target name="build" depends="package-extension">
<echo message="Building ${ant.project.name} extension package..."/>
</target>

</project>
Loading

0 comments on commit 0e5b0ea

Please sign in to comment.