Setting Up ZK Charts"

From Documentation
 
(32 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
{{ZKChartsEssentialsPageHeader}}
 
{{ZKChartsEssentialsPageHeader}}
  
== Prerequisites ==
+
= Prerequisites =
  
* Downloaded ZK 7 from [http://www.zkoss.org/download/zk.dsp].
 
  
=== Installing the Libraries ===
+
== Download the Jar and Install Manually ==
 +
* [http://www.zkoss.org/download/zk.dsp Downloaded the latest ZK]
 +
* [http://www.zkoss.org/download/zkcharts Downloaded the latest ZK Charts]
  
 
+
Depending on your IDE the steps will be different, however, the most important part is to include both ZK Charts and ZK’s JAR files in your project. The project should be a ZK Project or a Web Application Project depending on what environment you are using. Then, place the charts jar under '''WEB-INF/lib''' folder.
Depending on your IDE the steps will differ, however the most important part is both ZK Charts and ZK’s JAR files are included in your project. The project should be a ZK Project or a Web Application Project depending on what environment you are using. Then place the charts jar under '''WEB-INF/lib''' folder.
 
  
 
The easiest way to create a compatible project is to use [http://www.zkoss.org/download/zkstudio.dsp ZK Studio] and then include charts.jar as a library
 
The easiest way to create a compatible project is to use [http://www.zkoss.org/download/zkstudio.dsp ZK Studio] and then include charts.jar as a library
  
=== Maven Project ===
+
== Maven Project ==
  
 
+
If your project is managed by Maven already, you can adopt ZK Charts easily by simply adding a dependency like the following <ref>If you didn't setup zk maven repository yet, you have to [[ZK_Installation_Guide/Setting_up_IDE/Maven/Use_ZK_Maven_Artifacts/Resolving_ZK_Framework_Artifacts_via_Maven#How_to_Use_ZK_Maven_Repository | setup zk maven repository]] as well.</ref>:  
If your project is managed by Maven already, you can adopt ZK Chart easily by simply adding a dependency<ref>If you didn't setup zk maven repository yet, you have to [[ZK_Installation_Guide/Setting_up_IDE/Maven/Use_ZK_Maven_Artifacts/Resolving_ZK_Framework_Artifacts_via_Maven#How_to_Use_ZK_Maven_Repository | setup zk maven repository]] too.</ref>
 
 
 
Add the following dependency:
 
  
 
<source lang="xml" line="false>
 
<source lang="xml" line="false>
 
     <dependency>
 
     <dependency>
 
    <groupId>org.zkoss.chart</groupId>
 
    <groupId>org.zkoss.chart</groupId>
    <artifactId>charts</artifactId>
+
    <artifactId>zkcharts</artifactId>
    <version>1.0.0</version>
+
    <version>7.2.1.0-Eval</version> //this is just an example. Please use the latest version
 
</dependency>
 
</dependency>
 +
</source>
 +
 +
=== Evaluating users (60-days free evaluation) ===
 +
 +
* http://mavensync.zkoss.org/eval
 +
 +
'''Note''': ZK Charts evaluation version is put in''' ZK PE-eval / EE- eval''' maven repository. Please add the following config if you want to try the evaluation version.
 +
<source lang="xml" line="false>
 +
    <repositories>
 +
        <repository>
 +
            <id>ZK PE/EE Evaluation</id>
 +
            <url>https://mavensync.zkoss.org/eval/</url>
 +
        </repository>
 +
    </repositories>
 
</source>
 
</source>
  
 
<blockquote>
 
<blockquote>
----
+
-----
 
<references/>
 
<references/>
 
</blockquote>
 
</blockquote>
 +
 +
=== Premium users only ===
 +
 +
* <span style="color:red">'''Notice'''</span>: Need [[ZK_Pivottable_Essentials/Quick_Start/Using_Maven#Login_authentication|Login authentication]]
 +
 +
:  If you are our customer, please apply for a premium maven account to use ZK Premium Maven Repository.
 +
 +
* https://maven.zkoss.org/repo/zk/ee
 +
 +
<source lang="xml">
 +
<repositories>
 +
<repository>
 +
<id>ZK EE</id>
 +
<url>https://maven.zkoss.org/repo/zk/ee</url>
 +
</repository>
 +
</repositories>
 +
</source>
 +
 +
*Login authentication
 +
 +
Please refer to the [http://maven.apache.org/settings.html#Servers official documentation] of Apache Maven project for storing login authentication credentials in the global settings file.
 +
 +
* Location (if not already existed, you can create it manually)
 +
** Maven installation root:  <u>$M2_HOME/conf/settings.xml</u> - OR -
 +
** User's Maven root: <u>${user.home}/.m2/settings.xml</u>
 +
 +
<source lang="xml">
 +
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
 +
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 +
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
 +
http://maven.apache.org/xsd/settings-1.0.0.xsd">
 +
<servers>
 +
<server>
 +
<id>ZK EE</id>
 +
<!-- Same as the repository name used in your pom.xml -->
 +
<!-- Please replace the following with
 +
your premium username and password -->
 +
<username>your account</username>
 +
<password>your password</password>
 +
</server>
 +
</servers>
 +
</settings>
 +
</source>
 +
 +
*Sample of pom.xml for using licensed ZK Charts
 +
<source lang="xml">
 +
<project xmlns="http://maven.apache.org/POM/4.0.0"
 +
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 +
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
 +
http://maven.apache.org/xsd/maven-4.0.0.xsd">
 +
<modelVersion>4.0.0</modelVersion>
 +
<groupId>zkcharts</groupId>
 +
<artifactId>sample</artifactId>
 +
<version>0.0.1-SNAPSHOT</version>
 +
<properties>
 +
<!-- please change the version accordingly -->
 +
<zk.version>8.6.3</zk.version>
 +
<commons-io>1.3.1</commons-io>
 +
</properties>
 +
<packaging>war</packaging>
 +
<name>The sample Project</name>
 +
<repositories>
 +
<repository>
 +
<id>ZK CE</id>
 +
<name>ZK CE Repository</name>
 +
<url>http://mavensync.zkoss.org/maven2</url>
 +
</repository>
 +
<repository>
 +
<id>ZK EE</id>
 +
<url>https://maven.zkoss.org/repo/zk/ee</url>
 +
</repository>
 +
</repositories>
 +
<dependencies>
 +
<dependency>
 +
<groupId>org.zkoss.zk</groupId>
 +
<artifactId>zkbind</artifactId>
 +
<version>${zk.version}</version>
 +
</dependency>
 +
<dependency>
 +
<groupId>org.zkoss.zk</groupId>
 +
<artifactId>zul</artifactId>
 +
<version>${zk.version}</version>
 +
</dependency>
 +
<dependency>
 +
<groupId>org.zkoss.zk</groupId>
 +
<artifactId>zkplus</artifactId>
 +
<version>${zk.version}</version>
 +
</dependency>
 +
<dependency>
 +
<groupId>org.zkoss.zk</groupId>
 +
<artifactId>zhtml</artifactId>
 +
<version>${zk.version}</version>
 +
</dependency>
 +
 +
<dependency>
 +
<groupId>commons-io</groupId>
 +
<artifactId>commons-io</artifactId>
 +
<version>${commons-io}</version>
 +
</dependency>
 +
 +
<!-- ZK Charts -->
 +
<dependency>
 +
<groupId>org.zkoss.chart</groupId>
 +
<artifactId>zkcharts</artifactId>
 +
<version>3.0.3</version>
 +
</dependency>
 +
 +
</dependencies>
 +
</project>
 +
</source>
 +
 +
= Display Version=
 +
You can display ZK Charts version in a zul page with EL:
 +
 +
<source lang='xml'>
 +
<?import org.zkoss.chart.Version ?>
 +
 +
    Charts ${Version.UID}
 +
 +
</source>
 +
 +
To know bundled Highcharts version, evaluate the javascript variable below:
 +
 +
<source lang='javascript'>
 +
Highcharts.version
 +
</source>
 +
 +
= Default License Loading Path =
 +
ZK Charts loads a license file from the default path:
 +
 +
'''WEB-INF/classes/metainfo/chart/license'''
 +
 +
If the license is loaded successfully, you should see some license information printed on your application console like:
 +
 +
<source lang='text'>
 +
*** Potix Corporation License Information ***
 +
 +
    Licensed Company: test1
 +
    Certificate Number: AABB12345
 +
    Licensed Product: ZK Charts
 +
    Maximum Licensed Number: 1 Developer
 +
    Expiry Date: January 02, 2020
 +
 +
    To renew, obtain more licenses, or if you require help, please contact [email protected].
 +
</source>
 +
  
 
{{ZKChartsEssentialsPageFooter}}
 
{{ZKChartsEssentialsPageFooter}}

Latest revision as of 02:38, 12 April 2022


Prerequisites

Download the Jar and Install Manually

Depending on your IDE the steps will be different, however, the most important part is to include both ZK Charts and ZK’s JAR files in your project. The project should be a ZK Project or a Web Application Project depending on what environment you are using. Then, place the charts jar under WEB-INF/lib folder.

The easiest way to create a compatible project is to use ZK Studio and then include charts.jar as a library

Maven Project

If your project is managed by Maven already, you can adopt ZK Charts easily by simply adding a dependency like the following [1]:

1     <dependency>
2 	    <groupId>org.zkoss.chart</groupId>
3 	    <artifactId>zkcharts</artifactId>
4 	    <version>7.2.1.0-Eval</version>  //this is just an example. Please use the latest version
5 	</dependency>

Evaluating users (60-days free evaluation)

Note: ZK Charts evaluation version is put in ZK PE-eval / EE- eval maven repository. Please add the following config if you want to try the evaluation version.

1     <repositories>
2         <repository>
3             <id>ZK PE/EE Evaluation</id>
4             <url>https://mavensync.zkoss.org/eval/</url>
5         </repository>
6     </repositories>

  1. If you didn't setup zk maven repository yet, you have to setup zk maven repository as well.

Premium users only

If you are our customer, please apply for a premium maven account to use ZK Premium Maven Repository.
<repositories>
	<repository>
		<id>ZK EE</id>
		<url>https://maven.zkoss.org/repo/zk/ee</url>
	</repository>
</repositories>
  • Login authentication

Please refer to the official documentation of Apache Maven project for storing login authentication credentials in the global settings file.

  • Location (if not already existed, you can create it manually)
    • Maven installation root: $M2_HOME/conf/settings.xml - OR -
    • User's Maven root: ${user.home}/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
		http://maven.apache.org/xsd/settings-1.0.0.xsd">
	<servers>
		<server>
			<id>ZK EE</id>
			<!-- Same as the repository name used in your pom.xml -->
			<!-- Please replace the following with 
				your premium username and password -->
			<username>your account</username>
			<password>your password</password>
		</server>
	</servers>
</settings>
  • Sample of pom.xml for using licensed ZK Charts
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
		http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>zkcharts</groupId>
	<artifactId>sample</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<properties>
		<!-- please change the version accordingly -->
		<zk.version>8.6.3</zk.version>
		<commons-io>1.3.1</commons-io>
	</properties>
	<packaging>war</packaging>
	<name>The sample Project</name>
	<repositories>
		<repository>
			<id>ZK CE</id>
			<name>ZK CE Repository</name>
			<url>http://mavensync.zkoss.org/maven2</url>
		</repository>
		<repository>
			<id>ZK EE</id>
			<url>https://maven.zkoss.org/repo/zk/ee</url>
		</repository>
	</repositories>
	<dependencies>
		<dependency>
			<groupId>org.zkoss.zk</groupId>
			<artifactId>zkbind</artifactId>
			<version>${zk.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.zk</groupId>
			<artifactId>zul</artifactId>
			<version>${zk.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.zk</groupId>
			<artifactId>zkplus</artifactId>
			<version>${zk.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.zk</groupId>
			<artifactId>zhtml</artifactId>
			<version>${zk.version}</version>
		</dependency>
		
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>${commons-io}</version>
		</dependency>
		
		<!-- ZK Charts -->
		<dependency>
			<groupId>org.zkoss.chart</groupId>
			<artifactId>zkcharts</artifactId>
			<version>3.0.3</version>
		</dependency>

	</dependencies>
</project>

Display Version

You can display ZK Charts version in a zul page with EL:

<?import org.zkoss.chart.Version ?>

    Charts ${Version.UID}

To know bundled Highcharts version, evaluate the javascript variable below:

Highcharts.version

Default License Loading Path

ZK Charts loads a license file from the default path:

WEB-INF/classes/metainfo/chart/license

If the license is loaded successfully, you should see some license information printed on your application console like:

*** Potix Corporation License Information ***

     Licensed Company: test1
     Certificate Number: AABB12345
     Licensed Product: ZK Charts
     Maximum Licensed Number: 1 Developer
     Expiry Date: January 02, 2020

     To renew, obtain more licenses, or if you require help, please contact [email protected].


< Get Complete Source Code of This Book >


Last Update : 2022/04/12

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.