的
@@ -0,0 +1,52 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 32
|
||||
buildToolsVersion "32.0.0"
|
||||
defaultConfig {
|
||||
applicationId "com.anychart.anychart"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 32
|
||||
versionCode 7
|
||||
versionName "1.4"
|
||||
multiDexEnabled true
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
testOptions {
|
||||
unitTests.all {
|
||||
testLogging {
|
||||
outputs.upToDateWhen { false }
|
||||
events "passed", "failed", "standardError"
|
||||
showCauses true
|
||||
showExceptions true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation project(":anychart")
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.0'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
implementation 'androidx.annotation:annotation:1.2.0'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test:rules:1.3.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
exclude group: 'com.android.support', module: 'support-v4'
|
||||
exclude group: 'com.android.support', module: 'design'
|
||||
exclude group: 'com.android.support', module: 'recyclerview-v7'
|
||||
}
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-web:3.3.0'
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in C:\Users\NeverKnowsBest\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,758 @@
|
||||
package com.anychart.sample;
|
||||
|
||||
|
||||
import androidx.test.espresso.contrib.RecyclerViewActions;
|
||||
import androidx.test.espresso.web.webdriver.Locator;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.Espresso.pressBack;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isEnabled;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.web.sugar.Web.onWebView;
|
||||
import static androidx.test.espresso.web.webdriver.DriverAtoms.findElement;
|
||||
import static androidx.test.espresso.web.webdriver.DriverAtoms.webClick;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class MainActivityTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<MainActivity> activityRule = new ActivityTestRule<>(
|
||||
MainActivity.class, false, true);
|
||||
|
||||
@Test
|
||||
public void pieChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1p")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1q")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1r")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1s")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1t")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void columnChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_z")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_10")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_11")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_12")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_13")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_14")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_15")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_16")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_17")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lineChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(2, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1t")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_20")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1m")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void areaChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(3, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_23")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_24")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void barChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(4, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_47")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_48")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_49")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_4a")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_4b")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_4c")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_4e")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_4f")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_4g")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_4h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3i")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3j")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3k")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3l")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3m")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3n")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3o")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3p")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3q")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3r")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void vennDiagramTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(5, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_13")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_11")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_z")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_15")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_a")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_x")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void heatMapChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(6, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_v")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_w")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_x")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_y")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_z")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_10")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_11")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_12")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_13")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_14")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_15")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_16")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_17")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_18")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_19")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_1a")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_1b")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_1c")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_1d")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_1e")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_1f")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_1g")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_1h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_1i")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_1j")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tagCloudTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(7, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_simple-text_q")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_simple-text_s")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_simple-text_2a")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void waterfallChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(8, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1g")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1i")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1j")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1k")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1l")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1m")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1n")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1o")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1p")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1q")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1r")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1s")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1t")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void treeMapChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(9, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_10")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_12")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_13")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_14")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_15")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_16")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_18")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_17")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_11")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_27")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_10")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_11")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_12")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_rect_13")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void circularGaugeTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(10, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_b")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_c")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_d")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_e")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_f")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void thermometerTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(11, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void linearColorScaleTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(12, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void windSpeedTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(13, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1l")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void windDirectionTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(14, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_y")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scatterChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(15, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_13")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_6a")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resourceChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(16, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_6")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_7")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_9")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void radarChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(17, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2b")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2k")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_22")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void polarChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(18, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2y")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2a")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2d")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rangeChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(19, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2p")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2o")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2l")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2m")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2n")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2k")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2j")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_33")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_32")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_31")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_30")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verticalChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(20, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1b")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1c")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1d")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1e")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1f")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1g")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1i")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1j")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1k")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1l")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1m")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void funnelChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(21, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_i")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_j")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_k")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_l")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pertChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(22, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1c")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_40")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1d")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_43")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1g")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_44")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1j")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_48")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1l")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_4a")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1n")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_41")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1e")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_45")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1a")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void combinedChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(23, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1u")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1x")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bubbleChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(24, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_2u")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_3m")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_2w")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_3k")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_39")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_2r")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_3u")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void paretoChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(25, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2k")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2l")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pyramidChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(26, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_t")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_s")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_r")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_i")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void boxChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(27, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_10")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_11")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_15")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_19")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1d")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1l")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1p")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1t")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mosaicChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(28, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1n")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1o")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1p")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mekkoChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(29, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2b")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2a")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1d")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1c")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1b")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1a")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bar3DChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(30, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1y")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2m")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3a")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3y")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_25")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2t")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_45")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2b")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2z")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3n")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_4b")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void column3DChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(31, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_5e")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_5d")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_5l")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_5r")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_5x")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3k")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3r")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3x")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_4l")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2w")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_6r")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void area3DChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(32, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2j")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_23")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hiloChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(33, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_2b")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_3b")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ohlcChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(34, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quadrantChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(35, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_j")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_o")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_p")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_n")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_m")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_l")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_d")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_f")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sunburstChartTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(36, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_t")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_9")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_7")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_6")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_5")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_5")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_5")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bubbleMapTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(37, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_19")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_18")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_12")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_1a")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_17")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_1b")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_z")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_y")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_1c")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_10")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_11")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_circle_x")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void choroplethMapTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(38, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1k")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_u")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_1g")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_10")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_s")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pointMapTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(39, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_23")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_24")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_22")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_21")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_20")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_25")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_26")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void connectorMapTest() {
|
||||
onView(withId(R.id.recycler_view))
|
||||
.perform(RecyclerViewActions.actionOnItemAtPosition(40, click()));
|
||||
|
||||
onWebView().withElement(findElement(Locator.ID, "container")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_7h")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_7i")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_7k")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_7l")).perform(webClick());
|
||||
onWebView().withElement(findElement(Locator.ID, "ac_path_7m")).perform(webClick());
|
||||
onView(withId(R.id.web_view)).check(matches(isEnabled()));
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.anychart.sample">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".charts.PieChartActivity" />
|
||||
<activity android:name=".charts.ColumnChartActivity" />
|
||||
<activity android:name=".charts.LineChartActivity" />
|
||||
<activity android:name=".charts.VennDiagramActivity" />
|
||||
<activity android:name=".charts.HeatMapChartActivity" />
|
||||
<activity android:name=".charts.TagCloudActivity" />
|
||||
<activity android:name=".charts.WaterfallChartActivity" />
|
||||
<activity android:name=".charts.TreeMapChartActivity" />
|
||||
<activity android:name=".charts.CircularGaugeActivity" />
|
||||
<activity android:name=".charts.ScatterChartActivity" />
|
||||
<activity
|
||||
android:name=".charts.ResourceChartActivity"
|
||||
android:configChanges="keyboardHidden|orientation" />
|
||||
<activity android:name=".charts.RadarChartActivity" />
|
||||
<activity android:name=".charts.PolarChartActivity" />
|
||||
<activity android:name=".charts.RangeChartActivity" />
|
||||
<activity android:name=".charts.VerticalChartActivity" />
|
||||
<activity android:name=".charts.FunnelChartActivity" />
|
||||
<activity android:name=".charts.PertChartActivity" />
|
||||
<activity android:name=".charts.GanttChartActivity" />
|
||||
<activity android:name=".charts.CombinedChartActivity" />
|
||||
<activity android:name=".charts.BubbleChartActivity" />
|
||||
<activity android:name=".charts.ParetoChartActivity" />
|
||||
<activity android:name=".charts.PyramidActivity" />
|
||||
<activity android:name=".charts.AreaChartActivity" />
|
||||
<activity android:name=".charts.BarChartActivity" />
|
||||
<activity android:name=".charts.BoxChartActivity" />
|
||||
<activity android:name=".charts.Bar3DChartActivity" />
|
||||
<activity android:name=".charts.MosaicChartActivity" />
|
||||
<activity android:name=".charts.MekkoChartActivity" />
|
||||
<activity android:name=".charts.Column3DChartActivity" />
|
||||
<activity android:name=".charts.Area3DChartActivity" />
|
||||
<activity android:name=".charts.HiloChartActivity" />
|
||||
<activity android:name=".charts.QuadrantChartActivity" />
|
||||
<activity android:name=".charts.OHLCChartActivity" />
|
||||
<activity android:name=".charts.BubbleMapActivity" />
|
||||
<activity android:name=".charts.ChoroplethMapActivity" />
|
||||
<activity android:name=".charts.PointMapActivity" />
|
||||
<activity android:name=".charts.ConnectorMapActivity" />
|
||||
<activity android:name=".charts.SunburstChartActivity" />
|
||||
<activity android:name=".charts.ThermometerActivity" />
|
||||
<activity android:name=".charts.LinearColorScaleActivity" />
|
||||
<activity android:name=".charts.WindSpeedActivity" />
|
||||
<activity android:name=".charts.WindDirectionActivity" />
|
||||
<activity android:name=".charts.TwoPiesOneColumnActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
After Width: | Height: | Size: 59 KiB |
@@ -0,0 +1,118 @@
|
||||
package com.anychart.sample;
|
||||
|
||||
import android.content.res.Resources;
|
||||
|
||||
import com.anychart.sample.charts.Area3DChartActivity;
|
||||
import com.anychart.sample.charts.AreaChartActivity;
|
||||
import com.anychart.sample.charts.Bar3DChartActivity;
|
||||
import com.anychart.sample.charts.BarChartActivity;
|
||||
import com.anychart.sample.charts.BoxChartActivity;
|
||||
import com.anychart.sample.charts.BubbleChartActivity;
|
||||
import com.anychart.sample.charts.BubbleMapActivity;
|
||||
import com.anychart.sample.charts.ChoroplethMapActivity;
|
||||
import com.anychart.sample.charts.CircularGaugeActivity;
|
||||
import com.anychart.sample.charts.Column3DChartActivity;
|
||||
import com.anychart.sample.charts.ColumnChartActivity;
|
||||
import com.anychart.sample.charts.CombinedChartActivity;
|
||||
import com.anychart.sample.charts.ConnectorMapActivity;
|
||||
import com.anychart.sample.charts.FunnelChartActivity;
|
||||
import com.anychart.sample.charts.HeatMapChartActivity;
|
||||
import com.anychart.sample.charts.HiloChartActivity;
|
||||
import com.anychart.sample.charts.LineChartActivity;
|
||||
import com.anychart.sample.charts.LinearColorScaleActivity;
|
||||
import com.anychart.sample.charts.MekkoChartActivity;
|
||||
import com.anychart.sample.charts.MosaicChartActivity;
|
||||
import com.anychart.sample.charts.OHLCChartActivity;
|
||||
import com.anychart.sample.charts.ParetoChartActivity;
|
||||
import com.anychart.sample.charts.PertChartActivity;
|
||||
import com.anychart.sample.charts.PieChartActivity;
|
||||
import com.anychart.sample.charts.PointMapActivity;
|
||||
import com.anychart.sample.charts.PolarChartActivity;
|
||||
import com.anychart.sample.charts.PyramidActivity;
|
||||
import com.anychart.sample.charts.QuadrantChartActivity;
|
||||
import com.anychart.sample.charts.RadarChartActivity;
|
||||
import com.anychart.sample.charts.RangeChartActivity;
|
||||
import com.anychart.sample.charts.ResourceChartActivity;
|
||||
import com.anychart.sample.charts.ScatterChartActivity;
|
||||
import com.anychart.sample.charts.SunburstChartActivity;
|
||||
import com.anychart.sample.charts.TagCloudActivity;
|
||||
import com.anychart.sample.charts.ThermometerActivity;
|
||||
import com.anychart.sample.charts.TreeMapChartActivity;
|
||||
import com.anychart.sample.charts.TwoPiesOneColumnActivity;
|
||||
import com.anychart.sample.charts.VennDiagramActivity;
|
||||
import com.anychart.sample.charts.VerticalChartActivity;
|
||||
import com.anychart.sample.charts.WaterfallChartActivity;
|
||||
import com.anychart.sample.charts.WindDirectionActivity;
|
||||
import com.anychart.sample.charts.WindSpeedActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Chart {
|
||||
|
||||
private String name;
|
||||
private Class activityClass;
|
||||
|
||||
private Chart(String name, Class activityClass) {
|
||||
this.name = name;
|
||||
this.activityClass = activityClass;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
Class getActivityClass() {
|
||||
return activityClass;
|
||||
}
|
||||
|
||||
static ArrayList<Chart> createChartList(Resources resources) {
|
||||
ArrayList<Chart> chartList = new ArrayList<>();
|
||||
|
||||
chartList.add(new Chart(resources.getString(R.string.pie_chart), PieChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.column_chart), ColumnChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.line_chart), LineChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.area_chart), AreaChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.bar_chart), BarChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.venn_diagram), VennDiagramActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.heat_map_chart), HeatMapChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.tag_cloud), TagCloudActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.waterfall_chart), WaterfallChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.tree_map_chart), TreeMapChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.circular_gauge), CircularGaugeActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.thermometer), ThermometerActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.linear_color_scale), LinearColorScaleActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.wind_speed), WindSpeedActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.wind_direction), WindDirectionActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.scatter_chart), ScatterChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.resource_chart), ResourceChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.radar_chart), RadarChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.polar_chart), PolarChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.range_chart), RangeChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.vertical_chart), VerticalChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.funnel_chart), FunnelChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.pert_chart), PertChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.combined_chart), CombinedChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.bubble_chart), BubbleChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.pareto_chart), ParetoChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.pyramid_chart), PyramidActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.box_chart), BoxChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.mosaic_chart), MosaicChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.mekko_chart), MekkoChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.bar3d_chart), Bar3DChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.column3d_chart), Column3DChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.area3d_chart), Area3DChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.hilo_chart), HiloChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.ohlc_chart), OHLCChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.quadrant_chart), QuadrantChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.sunburst_chart), SunburstChartActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.bubble_map), BubbleMapActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.choropleth_map), ChoroplethMapActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.point_map), PointMapActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.connector_map), ConnectorMapActivity.class));
|
||||
chartList.add(new Chart(resources.getString(R.string.two_pies_one_column), TwoPiesOneColumnActivity.class));
|
||||
// chartList.add(new Chart(resources.getString(R.string.gantt_chart), GanttChartActivity.class));
|
||||
|
||||
return chartList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.anychart.sample;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ChartsAdapter extends RecyclerView.Adapter<ChartsAdapter.ViewHolder> {
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
TextView tvName;
|
||||
private Context context;
|
||||
|
||||
ViewHolder(Context context, View itemView) {
|
||||
super(itemView);
|
||||
|
||||
this.context = context;
|
||||
tvName = itemView.findViewById(R.id.tv_name);
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
Chart chart = chartList.get(position);
|
||||
|
||||
Intent intent = new Intent(context, chart.getActivityClass());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<Chart> chartList;
|
||||
private List<Chart> copyChartList;
|
||||
private Context context;
|
||||
|
||||
ChartsAdapter(Context context, List<Chart> chartList) {
|
||||
this.chartList = chartList;
|
||||
copyChartList = new ArrayList<>(chartList);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChartsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
Context context = parent.getContext();
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
|
||||
return new ViewHolder(context, inflater.inflate(R.layout.card_view_chart, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ChartsAdapter.ViewHolder viewHolder, int position) {
|
||||
Chart chart = chartList.get(position);
|
||||
|
||||
TextView textView = viewHolder.tvName;
|
||||
textView.setText(chart.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return chartList.size();
|
||||
}
|
||||
|
||||
public void filter(String text) {
|
||||
chartList.clear();
|
||||
if (text.isEmpty()){
|
||||
chartList.addAll(copyChartList);
|
||||
} else{
|
||||
text = text.toLowerCase();
|
||||
for (Chart chart: copyChartList){
|
||||
if (chart.getName().toLowerCase().contains(text)) {
|
||||
chartList.add(chart);
|
||||
}
|
||||
}
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.anychart.sample;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import android.view.View;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
RecyclerView recyclerView = findViewById(R.id.recycler_view);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
|
||||
List<Chart> chartList = Chart.createChartList(getResources());
|
||||
final ChartsAdapter adapter = new ChartsAdapter(this, chartList);
|
||||
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
final SearchView searchView = findViewById(R.id.search_view);
|
||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
adapter.filter(query);
|
||||
searchView.clearFocus();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
adapter.filter(newText);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
searchView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
searchView.setIconified(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Cartesian3d;
|
||||
import com.anychart.core.cartesian.series.Area3d;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.enums.HoverMode;
|
||||
import com.anychart.enums.Position;
|
||||
import com.anychart.enums.TooltipPositionMode;
|
||||
import com.anychart.graphics.vector.hatchfill.HatchFillType;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Area3DChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Cartesian3d area3d = AnyChart.area3d();
|
||||
|
||||
area3d.xAxis(0).labels().format("${%Value}");
|
||||
|
||||
area3d.animation(true);
|
||||
|
||||
area3d.yAxis(0).title("The Share Price");
|
||||
area3d.xAxis(0).title("Year/Month/Day");
|
||||
area3d.xAxis(0).labels().padding(5d, 5d, 0d, 5d);
|
||||
|
||||
area3d.title("The cost of ACME\\'s shares<br/>' +\n" +
|
||||
" '<span style=\"color:#212121; font-size: 13px;\">Statistics was collected from site N during September</span>");
|
||||
|
||||
area3d.title().useHtml(true);
|
||||
area3d.title().padding(0d, 0d, 20d, 0d);
|
||||
|
||||
List<DataEntry> seriesData = new ArrayList<>();
|
||||
seriesData.add(new CustomDataEntry("1986", 162, 42));
|
||||
seriesData.add(new CustomDataEntry("1987", 134, 54));
|
||||
seriesData.add(new CustomDataEntry("1988", 116, 26));
|
||||
seriesData.add(new CustomDataEntry("1989", 122, 32));
|
||||
seriesData.add(new CustomDataEntry("1990", 178, 68));
|
||||
seriesData.add(new CustomDataEntry("1991", 144, 54));
|
||||
seriesData.add(new CustomDataEntry("1992", 125, 35));
|
||||
seriesData.add(new CustomDataEntry("1993", 176, 66));
|
||||
seriesData.add(new CustomDataEntry("1994", 156, 80));
|
||||
seriesData.add(new CustomDataEntry("1995", 195, 120));
|
||||
seriesData.add(new CustomDataEntry("1996", 215, 115));
|
||||
seriesData.add(new CustomDataEntry("1997", 176, 36));
|
||||
seriesData.add(new CustomDataEntry("1998", 167, 47));
|
||||
seriesData.add(new CustomDataEntry("1999", 142, 72));
|
||||
seriesData.add(new CustomDataEntry("2000", 117, 37));
|
||||
seriesData.add(new CustomDataEntry("2001", 113, 23));
|
||||
seriesData.add(new CustomDataEntry("2002", 132, 30));
|
||||
seriesData.add(new CustomDataEntry("2003", 146, 46));
|
||||
seriesData.add(new CustomDataEntry("2004", 169, 59));
|
||||
seriesData.add(new CustomDataEntry("2005", 184, 44));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(seriesData);
|
||||
Mapping series1Data = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping series2Data = set.mapAs("{ x: 'x', value: 'value2' }");
|
||||
|
||||
Area3d series1 = area3d.area(series1Data);
|
||||
series1.name("ACME Share Price");
|
||||
series1.hovered().markers(false);
|
||||
series1.hatchFill("diagonal", "#000", 0.6d, 10d);
|
||||
|
||||
Area3d series2 = area3d.area(series2Data);
|
||||
series2.name("The Competitor\\'s Share Price");
|
||||
series2.hovered().markers(false);
|
||||
series2.hatchFill(HatchFillType.DIAGONAL_BRICK, "#000", 0.6d, 10d);
|
||||
|
||||
area3d.tooltip()
|
||||
.position(Position.CENTER_TOP)
|
||||
.positionMode(TooltipPositionMode.POINT)
|
||||
.anchor(Anchor.LEFT_BOTTOM)
|
||||
.offsetX(5d)
|
||||
.offsetY(5d);
|
||||
|
||||
area3d.interactivity().hoverMode(HoverMode.BY_X);
|
||||
area3d.zAspect("100%");
|
||||
|
||||
anyChartView.setChart(area3d);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
CustomDataEntry(String x, Number value, Number value2) {
|
||||
super(x, value);
|
||||
setValue("value2", value2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Cartesian;
|
||||
import com.anychart.core.cartesian.series.Area;
|
||||
import com.anychart.core.ui.Crosshair;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.HoverMode;
|
||||
import com.anychart.enums.MarkerType;
|
||||
import com.anychart.enums.ScaleStackMode;
|
||||
import com.anychart.enums.TooltipDisplayMode;
|
||||
import com.anychart.graphics.vector.Stroke;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AreaChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Cartesian areaChart = AnyChart.area();
|
||||
|
||||
areaChart.animation(true);
|
||||
|
||||
Crosshair crosshair = areaChart.crosshair();
|
||||
crosshair.enabled(true);
|
||||
// TODO yStroke xStroke in crosshair
|
||||
crosshair.yStroke((Stroke) null, null, null, (String) null, (String) null)
|
||||
.xStroke("#fff", 1d, null, (String) null, (String) null)
|
||||
.zIndex(39d);
|
||||
crosshair.yLabel(0).enabled(true);
|
||||
|
||||
areaChart.yScale().stackMode(ScaleStackMode.VALUE);
|
||||
|
||||
areaChart.title("Unaudited Apple Inc. Revenue by Operating Segments");
|
||||
|
||||
List<DataEntry> seriesData = new ArrayList<>();
|
||||
seriesData.add(new CustomDataEntry("Q2 2014", 17.982, 10.941, 9.835, 4.047, 2.841));
|
||||
seriesData.add(new CustomDataEntry("Q3 2014", 17.574, 8.659, 6.230, 2.627, 2.242));
|
||||
seriesData.add(new CustomDataEntry("Q4 2014", 19.75, 10.35, 6.292, 3.595, 2.136));
|
||||
seriesData.add(new CustomDataEntry("Q1 2015", 30.6, 17.2, 16.1, 5.4, 5.2));
|
||||
seriesData.add(new CustomDataEntry("Q2 2015", 21.316, 12.204, 16.823, 3.457, 4.210));
|
||||
seriesData.add(new CustomDataEntry("Q3 2015", 20.209, 10.342, 13.23, 2.872, 2.959));
|
||||
seriesData.add(new CustomDataEntry("Q4 2015", 21.773, 10.577, 12.518, 3.929, 2.704));
|
||||
seriesData.add(new CustomDataEntry("Q1 2016", 29.3, 17.9, 18.4, 4.8, 5.4));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(seriesData);
|
||||
Mapping series1Data = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping series2Data = set.mapAs("{ x: 'x', value: 'value2' }");
|
||||
Mapping series3Data = set.mapAs("{ x: 'x', value: 'value3' }");
|
||||
Mapping series4Data = set.mapAs("{ x: 'x', value: 'value4' }");
|
||||
Mapping series5Data = set.mapAs("{ x: 'x', value: 'value5' }");
|
||||
|
||||
Area series1 = areaChart.area(series1Data);
|
||||
series1.name("Americas");
|
||||
series1.stroke("3 #fff");
|
||||
series1.hovered().stroke("3 #fff");
|
||||
series1.hovered().markers().enabled(true);
|
||||
series1.hovered().markers()
|
||||
.type(MarkerType.CIRCLE)
|
||||
.size(4d)
|
||||
.stroke("1.5 #fff");
|
||||
series1.markers().zIndex(100d);
|
||||
|
||||
Area series2 = areaChart.area(series2Data);
|
||||
series2.name("Europe");
|
||||
series2.stroke("3 #fff");
|
||||
series2.hovered().stroke("3 #fff");
|
||||
series2.hovered().markers().enabled(true);
|
||||
series2.hovered().markers()
|
||||
.type(MarkerType.CIRCLE)
|
||||
.size(4d)
|
||||
.stroke("1.5 #fff");
|
||||
series2.markers().zIndex(100d);
|
||||
|
||||
Area series3 = areaChart.area(series3Data);
|
||||
series3.name("Greater China");
|
||||
series3.stroke("3 #fff");
|
||||
series3.hovered().stroke("3 #fff");
|
||||
series3.hovered().markers().enabled(true);
|
||||
series3.hovered().markers()
|
||||
.type(MarkerType.CIRCLE)
|
||||
.size(4d)
|
||||
.stroke("1.5 #fff");
|
||||
series3.markers().zIndex(100d);
|
||||
|
||||
Area series4 = areaChart.area(series4Data);
|
||||
series4.name("Japan");
|
||||
series4.stroke("3 #fff");
|
||||
series4.hovered().stroke("3 #fff");
|
||||
series4.hovered().markers().enabled(true);
|
||||
series4.hovered().markers()
|
||||
.type(MarkerType.CIRCLE)
|
||||
.size(4d)
|
||||
.stroke("1.5 #fff");
|
||||
series4.markers().zIndex(100d);
|
||||
|
||||
Area series5 = areaChart.area(series5Data);
|
||||
series5.name("Rest of Asia Pacific");
|
||||
series5.stroke("3 #fff");
|
||||
series5.hovered().stroke("3 #fff");
|
||||
series5.hovered().markers().enabled(true);
|
||||
series5.hovered().markers()
|
||||
.type(MarkerType.CIRCLE)
|
||||
.size(4d)
|
||||
.stroke("1.5 #fff");
|
||||
series5.markers().zIndex(100d);
|
||||
|
||||
areaChart.legend().enabled(true);
|
||||
areaChart.legend().fontSize(13d);
|
||||
areaChart.legend().padding(0d, 0d, 20d, 0d);
|
||||
|
||||
areaChart.xAxis(0).title(false);
|
||||
areaChart.yAxis(0).title("Revenue (in Billons USD)");
|
||||
|
||||
areaChart.interactivity().hoverMode(HoverMode.BY_X);
|
||||
areaChart.tooltip()
|
||||
.valuePrefix("$")
|
||||
.valuePostfix(" bln.")
|
||||
.displayMode(TooltipDisplayMode.UNION);
|
||||
|
||||
anyChartView.setChart(areaChart);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
CustomDataEntry(String x, Number value, Number value2, Number value3, Number value4, Number value5) {
|
||||
super(x, value);
|
||||
setValue("value2", value2);
|
||||
setValue("value3", value3);
|
||||
setValue("value4", value4);
|
||||
setValue("value5", value5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Cartesian3d;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.enums.HoverMode;
|
||||
import com.anychart.enums.TooltipPositionMode;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Bar3DChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Cartesian3d bar3d = AnyChart.bar3d();
|
||||
|
||||
bar3d.animation(true);
|
||||
|
||||
bar3d.padding(10d, 40d, 5d, 20d);
|
||||
|
||||
bar3d.title("Top 3 Products with Region Sales Data");
|
||||
|
||||
bar3d.yScale().minimum(0d);
|
||||
|
||||
bar3d.xAxis(0).labels()
|
||||
.rotation(-90d)
|
||||
.padding(0d, 0d, 20d, 0d);
|
||||
|
||||
bar3d.yAxis(0).labels().format("${%Value}{groupsSeparator: }");
|
||||
|
||||
bar3d.yAxis(0).title("Revenue in Dollars");
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomDataEntry("Nail polish", 6229, 4376, 4054, 2381));
|
||||
data.add(new CustomDataEntry("Eyebrow pencil", 9332, 8987, 5067, 1401));
|
||||
data.add(new CustomDataEntry("Lipstick", 9256, 7376, 5054, 981));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(data);
|
||||
Mapping bar1Data = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping bar2Data = set.mapAs("{ x: 'x', value: 'value2' }");
|
||||
Mapping bar3Data = set.mapAs("{ x: 'x', value: 'value3' }");
|
||||
Mapping bar4Data = set.mapAs("{ x: 'x', value: 'value4' }");
|
||||
|
||||
bar3d.bar(bar1Data)
|
||||
.name("Florida");
|
||||
|
||||
bar3d.bar(bar2Data)
|
||||
.name("Texas");
|
||||
|
||||
bar3d.bar(bar3Data)
|
||||
.name("Arizona");
|
||||
|
||||
bar3d.bar(bar4Data)
|
||||
.name("Nevada");
|
||||
|
||||
bar3d.legend().enabled(true);
|
||||
bar3d.legend().fontSize(13d);
|
||||
bar3d.legend().padding(0d, 0d, 20d, 0d);
|
||||
|
||||
bar3d.interactivity().hoverMode(HoverMode.SINGLE);
|
||||
|
||||
bar3d.tooltip()
|
||||
.positionMode(TooltipPositionMode.POINT)
|
||||
.position("right")
|
||||
.anchor(Anchor.LEFT_CENTER)
|
||||
.offsetX(5d)
|
||||
.offsetY(0d)
|
||||
.format("${%Value}");
|
||||
|
||||
bar3d.zAspect("10%")
|
||||
.zPadding(20d)
|
||||
.zAngle(45d)
|
||||
.zDistribution(true);
|
||||
|
||||
anyChartView.setChart(bar3d);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
CustomDataEntry(String x, Number value, Number value2, Number value3, Number value4) {
|
||||
super(x, value);
|
||||
setValue("value2", value2);
|
||||
setValue("value3", value3);
|
||||
setValue("value4", value4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Cartesian;
|
||||
import com.anychart.core.axes.Linear;
|
||||
import com.anychart.core.cartesian.series.Bar;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.enums.HoverMode;
|
||||
import com.anychart.enums.LabelsOverlapMode;
|
||||
import com.anychart.enums.Orientation;
|
||||
import com.anychart.enums.ScaleStackMode;
|
||||
import com.anychart.enums.TooltipDisplayMode;
|
||||
import com.anychart.enums.TooltipPositionMode;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BarChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Cartesian barChart = AnyChart.bar();
|
||||
|
||||
barChart.animation(true);
|
||||
|
||||
barChart.padding(10d, 20d, 5d, 20d);
|
||||
|
||||
barChart.yScale().stackMode(ScaleStackMode.VALUE);
|
||||
|
||||
barChart.yAxis(0).labels().format(
|
||||
"function() {\n" +
|
||||
" return Math.abs(this.value).toLocaleString();\n" +
|
||||
" }");
|
||||
|
||||
barChart.yAxis(0d).title("Revenue in Dollars");
|
||||
|
||||
barChart.xAxis(0d).overlapMode(LabelsOverlapMode.ALLOW_OVERLAP);
|
||||
|
||||
Linear xAxis1 = barChart.xAxis(1d);
|
||||
xAxis1.enabled(true);
|
||||
xAxis1.orientation(Orientation.RIGHT);
|
||||
xAxis1.overlapMode(LabelsOverlapMode.ALLOW_OVERLAP);
|
||||
|
||||
barChart.title("Cosmetic Sales by Gender");
|
||||
|
||||
barChart.interactivity().hoverMode(HoverMode.BY_X);
|
||||
|
||||
barChart.tooltip()
|
||||
.title(false)
|
||||
.separator(false)
|
||||
.displayMode(TooltipDisplayMode.SEPARATED)
|
||||
.positionMode(TooltipPositionMode.POINT)
|
||||
.useHtml(true)
|
||||
.fontSize(12d)
|
||||
.offsetX(5d)
|
||||
.offsetY(0d)
|
||||
.format(
|
||||
"function() {\n" +
|
||||
" return '<span style=\"color: #D9D9D9\">$</span>' + Math.abs(this.value).toLocaleString();\n" +
|
||||
" }");
|
||||
|
||||
List<DataEntry> seriesData = new ArrayList<>();
|
||||
seriesData.add(new CustomDataEntry("Nail polish", 5376, -229));
|
||||
seriesData.add(new CustomDataEntry("Eyebrow pencil", 10987, -932));
|
||||
seriesData.add(new CustomDataEntry("Rouge", 7624, -5221));
|
||||
seriesData.add(new CustomDataEntry("Lipstick", 8814, -256));
|
||||
seriesData.add(new CustomDataEntry("Eyeshadows", 8998, -308));
|
||||
seriesData.add(new CustomDataEntry("Eyeliner", 9321, -432));
|
||||
seriesData.add(new CustomDataEntry("Foundation", 8342, -701));
|
||||
seriesData.add(new CustomDataEntry("Lip gloss", 6998, -908));
|
||||
seriesData.add(new CustomDataEntry("Mascara", 9261, -712));
|
||||
seriesData.add(new CustomDataEntry("Shampoo", 5376, -9229));
|
||||
seriesData.add(new CustomDataEntry("Hair conditioner", 10987, -13932));
|
||||
seriesData.add(new CustomDataEntry("Body lotion", 7624, -10221));
|
||||
seriesData.add(new CustomDataEntry("Shower gel", 8814, -12256));
|
||||
seriesData.add(new CustomDataEntry("Soap", 8998, -5308));
|
||||
seriesData.add(new CustomDataEntry("Eye fresher", 9321, -432));
|
||||
seriesData.add(new CustomDataEntry("Deodorant", 8342, -11701));
|
||||
seriesData.add(new CustomDataEntry("Hand cream", 7598, -5808));
|
||||
seriesData.add(new CustomDataEntry("Foot cream", 6098, -3987));
|
||||
seriesData.add(new CustomDataEntry("Night cream", 6998, -847));
|
||||
seriesData.add(new CustomDataEntry("Day cream", 5304, -4008));
|
||||
seriesData.add(new CustomDataEntry("Vanila cream", 9261, -712));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(seriesData);
|
||||
Mapping series1Data = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping series2Data = set.mapAs("{ x: 'x', value: 'value2' }");
|
||||
|
||||
Bar series1 = barChart.bar(series1Data);
|
||||
series1.name("Females")
|
||||
.color("HotPink");
|
||||
series1.tooltip()
|
||||
.position("right")
|
||||
.anchor(Anchor.LEFT_CENTER);
|
||||
|
||||
Bar series2 = barChart.bar(series2Data);
|
||||
series2.name("Males");
|
||||
series2.tooltip()
|
||||
.position("left")
|
||||
.anchor(Anchor.RIGHT_CENTER);
|
||||
|
||||
barChart.legend().enabled(true);
|
||||
barChart.legend().inverted(true);
|
||||
barChart.legend().fontSize(13d);
|
||||
barChart.legend().padding(0d, 0d, 20d, 0d);
|
||||
|
||||
anyChartView.setChart(barChart);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
CustomDataEntry(String x, Number value, Number value2) {
|
||||
super(x, value);
|
||||
setValue("value2", value2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.BoxDataEntry;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.charts.Cartesian;
|
||||
import com.anychart.core.cartesian.series.Box;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BoxChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Cartesian boxChart = AnyChart.box();
|
||||
|
||||
boxChart.title("Top 10 Jobs Salaries Grades Per Year Calisota, USA");
|
||||
|
||||
boxChart.xAxis(0).staggerMode(true);
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomBoxDataEntry("Registered Nurse", 20000, 26000, 27000, 32000, 38000, new Integer[]{50000, 52000}));
|
||||
data.add(new CustomBoxDataEntry("Dental Hygienist", 24000, 28000, 32000, 38000, 42000, new Integer[]{48000}));
|
||||
data.add(new CustomBoxDataEntry("Computer Systems Analyst", 40000, 49000, 62000, 73000, 88000, new Integer[]{32000, 29000, 106000}));
|
||||
data.add(new CustomBoxDataEntry("Physical Therapist", 52000, 59000, 65000, 74000, 83000, new Integer[]{91000}));
|
||||
data.add(new CustomBoxDataEntry("Software Developer", 45000, 54000, 66000, 81000, 97000, new Integer[]{120000}));
|
||||
data.add(new CustomBoxDataEntry("Information Security Analyst", 47000, 56000, 69000, 85000, 100000, new Integer[]{110000, 115000, 32000}));
|
||||
data.add(new CustomBoxDataEntry("Physician Assistant", 67000, 72000, 84000, 95000, 110000, new Integer[]{57000, 54000}));
|
||||
data.add(new CustomBoxDataEntry("Dentist", 75000, 99000, 123000, 160000, 210000, new Integer[]{220000, 70000}));
|
||||
data.add(new CustomBoxDataEntry("Physician", 58000, 96000, 130000, 170000, 200000, new Integer[]{42000, 210000, 215000}));
|
||||
|
||||
Box box = boxChart.box(data);
|
||||
|
||||
box.whiskerWidth("20%");
|
||||
|
||||
anyChartView.setChart(boxChart);
|
||||
}
|
||||
|
||||
private class CustomBoxDataEntry extends BoxDataEntry {
|
||||
CustomBoxDataEntry(String x, Integer low, Integer q1, Integer median, Integer q3, Integer high, Integer[] outliers) {
|
||||
super(x, low, q1, median, q3, high);
|
||||
setValue("outliers", outliers);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.BubbleDataEntry;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.charts.Scatter;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BubbleChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Scatter bubble = AnyChart.bubble();
|
||||
|
||||
bubble.animation(true);
|
||||
|
||||
bubble.title().enabled(true);
|
||||
bubble.title().useHtml(true);
|
||||
bubble.title()
|
||||
.padding(0d, 0d, 10d, 0d)
|
||||
.text("Best sportsmen training data ' +\n" +
|
||||
" '<br/><span style=\"color:#929292; font-size: 12px;\">' +\n" +
|
||||
" '(bubble size means duration, each bubble represents one training)</span>");
|
||||
|
||||
bubble.padding(20d, 20d, 10d, 20d);
|
||||
|
||||
bubble.yGrid(true)
|
||||
.xGrid(true)
|
||||
.xMinorGrid(true)
|
||||
.yMinorGrid(true);
|
||||
|
||||
bubble.minBubbleSize(5d)
|
||||
.maxBubbleSize(40d);
|
||||
|
||||
bubble.xAxis(0)
|
||||
.title("Average pulse during training")
|
||||
.minorTicks(true);
|
||||
bubble.yAxis(0)
|
||||
.title("Average power")
|
||||
.minorTicks(true);
|
||||
|
||||
bubble.legend().enabled(true);
|
||||
bubble.labels().padding(0d, 0d, 10d, 0d);
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomBubbleDataEntry(1, 184, 113, "10/13/2014", 120));
|
||||
data.add(new CustomBubbleDataEntry(1, 180, 94, "03/25/2015", 45));
|
||||
data.add(new CustomBubbleDataEntry(1, 145, 137, "11/23/2014", 123));
|
||||
data.add(new CustomBubbleDataEntry(1, 136, 89, "02/02/2015", 89));
|
||||
data.add(new CustomBubbleDataEntry(1, 180, 96, "12/24/2014", 118));
|
||||
data.add(new CustomBubbleDataEntry(1, 149, 113, "11/20/2014", 60));
|
||||
data.add(new CustomBubbleDataEntry(1, 161, 94, "04/10/2015", 87));
|
||||
data.add(new CustomBubbleDataEntry(1, 168, 141, "02/03/2015", 45));
|
||||
data.add(new CustomBubbleDataEntry(1, 173, 127, "01/14/2015", 89));
|
||||
|
||||
bubble.bubble(data)
|
||||
.name("Christopher Sanchez");
|
||||
|
||||
data.clear();
|
||||
data.add(new CustomBubbleDataEntry(2, 165, 145, "10/22/2014", 95));
|
||||
data.add(new CustomBubbleDataEntry(2, 147, 71, "07/25/2014", 53));
|
||||
data.add(new CustomBubbleDataEntry(2, 157, 138, "08/18/2014", 115));
|
||||
data.add(new CustomBubbleDataEntry(2, 179, 107, "07/05/2014", 91));
|
||||
data.add(new CustomBubbleDataEntry(2, 187, 65, "06/21/2014", 90));
|
||||
data.add(new CustomBubbleDataEntry(2, 142, 139, "11/05/2014", 94));
|
||||
data.add(new CustomBubbleDataEntry(2, 136, 90, "06/22/2014", 90));
|
||||
data.add(new CustomBubbleDataEntry(2, 166, 70, "09/18/2014", 54));
|
||||
data.add(new CustomBubbleDataEntry(2, 161, 131, "01/07/2015", 121));
|
||||
|
||||
bubble.bubble(data)
|
||||
.name("Judy Evans");
|
||||
|
||||
data.clear();
|
||||
data.add(new CustomBubbleDataEntry(3, 145, 141, "09/15/2014", 95));
|
||||
data.add(new CustomBubbleDataEntry(3, 174, 144, "10/28/2014", 53));
|
||||
data.add(new CustomBubbleDataEntry(3, 180, 94, "03/03/2015", 115));
|
||||
data.add(new CustomBubbleDataEntry(3, 170, 142, "10/29/2014", 91));
|
||||
data.add(new CustomBubbleDataEntry(3, 146, 120, "02/28/2015", 90));
|
||||
data.add(new CustomBubbleDataEntry(3, 164, 66, "06/24/2014", 94));
|
||||
data.add(new CustomBubbleDataEntry(3, 166, 137, "03/24/2015", 90));
|
||||
data.add(new CustomBubbleDataEntry(3, 181, 121, "06/02/2014", 54));
|
||||
|
||||
bubble.bubble(data)
|
||||
.name("Walter Burke");
|
||||
|
||||
data.clear();
|
||||
data.add(new CustomBubbleDataEntry(4, 169, 84, "05/16/2014", 46));
|
||||
data.add(new CustomBubbleDataEntry(4, 176, 123, "01/10/2015", 43));
|
||||
data.add(new CustomBubbleDataEntry(4, 163, 106, "08/06/2014", 105));
|
||||
data.add(new CustomBubbleDataEntry(4, 167, 96, "09/01/2014", 90));
|
||||
data.add(new CustomBubbleDataEntry(4, 162, 131, "05/24/2014", 91));
|
||||
data.add(new CustomBubbleDataEntry(4, 142, 124, "12/24/2014", 112));
|
||||
data.add(new CustomBubbleDataEntry(4, 142, 70, "01/16/2015", 56));
|
||||
data.add(new CustomBubbleDataEntry(4, 174, 89, "02/09/2015", 90));
|
||||
|
||||
bubble.bubble(data)
|
||||
.name("Daniel Williamson");
|
||||
|
||||
bubble.tooltip()
|
||||
.useHtml(true)
|
||||
.fontColor("#fff")
|
||||
.format("function() {\n" +
|
||||
" return this.getData('data') + '<br/>' +\n" +
|
||||
" 'Power: <span style=\"color: #d2d2d2; font-size: 12px\">' +\n" +
|
||||
" this.getData('value') + '</span></strong><br/>' +\n" +
|
||||
" 'Pulse: <span style=\"color: #d2d2d2; font-size: 12px\">' +\n" +
|
||||
" this.getData('x') + '</span></strong><br/>' +\n" +
|
||||
" 'Duration: <span style=\"color: #d2d2d2; font-size: 12px\">' +\n" +
|
||||
" this.getData('size') + ' min.</span></strong>';\n" +
|
||||
" }");
|
||||
|
||||
anyChartView.setChart(bubble);
|
||||
}
|
||||
|
||||
private class CustomBubbleDataEntry extends BubbleDataEntry {
|
||||
|
||||
CustomBubbleDataEntry(Integer training, Integer x, Integer value, String data, Integer size) {
|
||||
super(x, value, size);
|
||||
setValue("training", training);
|
||||
setValue("data", data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.charts.Map;
|
||||
import com.anychart.core.map.series.Bubble;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.Align;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.enums.BackgroundCornersType;
|
||||
import com.anychart.enums.LegendLayout;
|
||||
import com.anychart.enums.SelectionMode;
|
||||
import com.anychart.graphics.vector.SolidFill;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BubbleMapActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Map bubbleMap = AnyChart.bubbleMap();
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
|
||||
data.add(new CustomDataEntry("AU.NS", 25, 7));
|
||||
data.add(new CustomDataEntry("AU.NT", 15, 4));
|
||||
data.add(new CustomDataEntry("AU.WA", 23, 9));
|
||||
data.add(new CustomDataEntry("AU.SA", 21, 15));
|
||||
data.add(new CustomDataEntry("AU.VI", 5, 3));
|
||||
data.add(new CustomDataEntry("AU.QL", 2, null));
|
||||
data.add(new CustomDataEntry("AU.TS", 9, 1));
|
||||
|
||||
bubbleMap.geoData("anychart.maps.australia");
|
||||
|
||||
bubbleMap.title().enabled(true);
|
||||
bubbleMap.title().text("ACME corp. Offices by Australian Regions");
|
||||
bubbleMap.title().padding(0, 0, 10, 0);
|
||||
|
||||
Set dataSet1 = Set.instantiate();
|
||||
dataSet1.data(data);
|
||||
Mapping mapping1 = dataSet1.mapAs("{ 'id': 'id', 'size': 'offices' }");
|
||||
|
||||
Bubble series1 = bubbleMap.bubble(mapping1);
|
||||
series1.name("Amount of Offices in Region");
|
||||
series1.legendItem("{ iconType: 'circle' }");
|
||||
series1.geoIdField("code_hasc");
|
||||
series1.labels()
|
||||
.anchor(Anchor.LEFT_TOP)
|
||||
.position("right")
|
||||
.fontSize(14)
|
||||
.fontColor("#212121");
|
||||
|
||||
Set dataSet2 = Set.instantiate();
|
||||
dataSet2.data(data);
|
||||
Mapping mapping2 = dataSet2.mapAs("{ 'id': 'id', 'size': 'last_year' }");
|
||||
|
||||
Bubble series2 = bubbleMap.bubble(mapping2);
|
||||
series2.name("Were Opened in Last Year");
|
||||
series2.labels(false);
|
||||
series2.legendItem("{ iconType: 'circle' }");
|
||||
series2.geoIdField("code_hasc");
|
||||
|
||||
bubbleMap.tooltip()
|
||||
.useHtml(true)
|
||||
.title("{ fontColor: '#7c868e' }")
|
||||
.padding(8, 13, 10, 13)
|
||||
.format("function() {\n" +
|
||||
" var span_for_value = '<span style=\"color: #545f69; font-size: 12px; font-weight: bold\">';\n" +
|
||||
" var span_for_description = '<br/><span style=\"color: #7c868e; font-size: 12px; font-style: italic\">';\n" +
|
||||
" if (this.getData('last_year') > 0) {\n" +
|
||||
" return span_for_value + this.getData('offices') + ' offices</span></strong>' +\n" +
|
||||
" span_for_description + this.getData('last_year') + ' opened in last year</span>';\n" +
|
||||
" } else {\n" +
|
||||
" return span_for_value + this.getData('offices') + ' offices</span></strong>';\n" +
|
||||
" }\n" +
|
||||
" }");
|
||||
bubbleMap.tooltip().background()
|
||||
.enabled(true)
|
||||
.fill(new SolidFill("#fff", 1))
|
||||
.stroke("#c1c1c1")
|
||||
.corners("3")
|
||||
.cornerType(BackgroundCornersType.ROUND);
|
||||
|
||||
bubbleMap.legend()
|
||||
.enabled(true)
|
||||
.position("center-top")
|
||||
.align(Align.CENTER)
|
||||
.itemsLayout(LegendLayout.HORIZONTAL)
|
||||
.padding(0, 0, 30, 0)
|
||||
.paginator(false);
|
||||
bubbleMap.interactivity().selectionMode(SelectionMode.NONE);
|
||||
|
||||
anyChartView.addScript("file:///android_asset/australia.js");
|
||||
anyChartView.addScript("file:///android_asset/proj4.js");
|
||||
anyChartView.setChart(bubbleMap);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends DataEntry {
|
||||
public CustomDataEntry(String id, Integer offices, Integer lastYear) {
|
||||
setValue("id", id);
|
||||
setValue("offices", offices);
|
||||
setValue("last_year", lastYear);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.charts.Map;
|
||||
import com.anychart.core.map.series.Choropleth;
|
||||
import com.anychart.core.ui.ColorRange;
|
||||
import com.anychart.enums.SelectionMode;
|
||||
import com.anychart.enums.SidePosition;
|
||||
import com.anychart.graphics.vector.text.HAlign;
|
||||
import com.anychart.sample.R;
|
||||
import com.anychart.scales.LinearColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ChoroplethMapActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Map map = AnyChart.map();
|
||||
|
||||
map.title()
|
||||
.enabled(true)
|
||||
.useHtml(true)
|
||||
.hAlign(HAlign.CENTER)
|
||||
.fontFamily("Verdana, Helvetica, Arial, sans-serif")
|
||||
.padding(10, 0, 10, 0)
|
||||
.text("<span style=\"color:#7c868e; font-size: 18px\"> The States That" +
|
||||
"Love Wine The Most.</span> <br>" +
|
||||
"<span style=\"color:#545f69; font-size: 14px\">Litres of wine" +
|
||||
"per person each state consumed in 2013.</span>");
|
||||
|
||||
map.credits()
|
||||
.enabled(true)
|
||||
.url("https://en.wikipedia.org/wiki/List_of_sovereign_states_and_dependent_territories_by_population_density")
|
||||
.text("Data source: https://en.wikipedia.org/wiki/List_of_sovereign_states_and_dependent_territories_by_population_density")
|
||||
.logoSrc("https://static.anychart.com/images/maps_samples/USA_Map_with_Linear_Scale/favicon.ico");
|
||||
|
||||
map.geoData("anychart.maps.united_states_of_america");
|
||||
|
||||
ColorRange colorRange = map.colorRange();
|
||||
colorRange.enabled(true)
|
||||
.colorLineSize(10)
|
||||
.stroke("#B9B9B9")
|
||||
.labels("{ 'padding': 3 }")
|
||||
.labels("{ 'size': 7 }");
|
||||
colorRange.ticks()
|
||||
.enabled(true)
|
||||
.stroke("#B9B9B9")
|
||||
.position(SidePosition.OUTSIDE)
|
||||
.length(10);
|
||||
colorRange.minorTicks()
|
||||
.enabled(true)
|
||||
.stroke("#B9B9B9")
|
||||
.position("outside")
|
||||
.length(5);
|
||||
|
||||
map.interactivity().selectionMode(SelectionMode.NONE);
|
||||
map.padding(0, 0, 0, 0);
|
||||
|
||||
Choropleth series = map.choropleth(getData());
|
||||
LinearColor linearColor = LinearColor.instantiate();
|
||||
linearColor.colors(new String[]{ "#c2e9fb", "#81d4fa", "#01579b", "#002746"});
|
||||
series.colorScale(linearColor);
|
||||
series.hovered()
|
||||
.fill("#f48fb1")
|
||||
.stroke("#f99fb9");
|
||||
series.selected()
|
||||
.fill("#c2185b")
|
||||
.stroke("#c2185b");
|
||||
series.labels().enabled(true);
|
||||
series.labels().fontSize(10);
|
||||
series.labels().fontColor("#212121");
|
||||
series.labels().format("{%Value}");
|
||||
|
||||
series.tooltip()
|
||||
.useHtml(true)
|
||||
.format("function() {\n" +
|
||||
" return '<span style=\"font-size: 13px\">' + this.value + ' litres per capita</span>';\n" +
|
||||
" }");
|
||||
|
||||
|
||||
anyChartView.addScript("file:///android_asset/united_states_of_america.js");
|
||||
anyChartView.addScript("file:///android_asset/proj4.js");
|
||||
anyChartView.setChart(map);
|
||||
}
|
||||
|
||||
private List<DataEntry> getData() {
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
|
||||
data.add(new CustomDataEntry("US.MN", "Minnesota", 8.4));
|
||||
data.add(new CustomDataEntry("US.MT", "Montana", 8.5));
|
||||
data.add(new CustomDataEntry("US.ND", "North Dakota", 5.1));
|
||||
data.add(new CustomDataEntry("US.ID", "Idaho", 8));
|
||||
data.add(new CustomDataEntry("US.WA", "Washington", 13.1));
|
||||
data.add(new CustomDataEntry("US.AZ", "Arizona", 9.7));
|
||||
data.add(new CustomDataEntry("US.CA", "California", 14));
|
||||
data.add(new CustomDataEntry("US.CO", "Colorado", 8.7));
|
||||
data.add(new CustomDataEntry("US.NV", "Nevada", 14.7));
|
||||
data.add(new CustomDataEntry("US.NM", "New Mexico", 6.9));
|
||||
data.add(new CustomDataEntry("US.OR", "Oregon", 12.2));
|
||||
data.add(new CustomDataEntry("US.UT", "Utah", 3.2));
|
||||
data.add(new CustomDataEntry("US.WY", "Wyoming", 5.2));
|
||||
data.add(new CustomDataEntry("US.AR", "Arkansas", 4.2));
|
||||
data.add(new CustomDataEntry("US.IA", "Iowa", 4.7));
|
||||
data.add(new CustomDataEntry("US.KS", "Kansas", 3.2));
|
||||
data.add(new CustomDataEntry("US.MO", "Missouri", 7.2));
|
||||
data.add(new CustomDataEntry("US.NE", "Nebraska", 5));
|
||||
data.add(new CustomDataEntry("US.OK", "Oklahoma", 4.5));
|
||||
data.add(new CustomDataEntry("US.SD", "South Dakota", 5));
|
||||
data.add(new CustomDataEntry("US.LA", "Louisiana", 5.7));
|
||||
data.add(new CustomDataEntry("US.TX", "Texas", 5));
|
||||
data.add(new CustomDataEntry("US.CT", "Connecticut", 14.4, new LabelDataEntry(false)));
|
||||
data.add(new CustomDataEntry("US.MA", "Massachusetts", 16.9, new LabelDataEntry(false)));
|
||||
data.add(new CustomDataEntry("US.NH", "New Hampshire", 19.6));
|
||||
data.add(new CustomDataEntry("US.RI", "Rhode Island", 14, new LabelDataEntry(false)));
|
||||
data.add(new CustomDataEntry("US.VT", "Vermont", 17.5));
|
||||
data.add(new CustomDataEntry("US.AL", "Alabama", 6));
|
||||
data.add(new CustomDataEntry("US.FL", "Florida", 12.4));
|
||||
data.add(new CustomDataEntry("US.GA", "Georgia", 5.9));
|
||||
data.add(new CustomDataEntry("US.MS", "Mississippi", 2.8));
|
||||
data.add(new CustomDataEntry("US.SC", "South Carolina", 6.1));
|
||||
data.add(new CustomDataEntry("US.IL", "Illinois", 10.2));
|
||||
data.add(new CustomDataEntry("US.IN", "Indiana", 6.1));
|
||||
data.add(new CustomDataEntry("US.KY", "Kentucky", 3.9));
|
||||
data.add(new CustomDataEntry("US.NC", "North Carolina", 6.6));
|
||||
data.add(new CustomDataEntry("US.OH", "Ohio", 7.2));
|
||||
data.add(new CustomDataEntry("US.TN", "Tennessee", 5.4));
|
||||
data.add(new CustomDataEntry("US.VA", "Virginia", 10.7));
|
||||
data.add(new CustomDataEntry("US.WI", "Wisconsin", 9.1));
|
||||
data.add(new CustomDataEntry("US.WY", "Wyoming", 5.2, new LabelDataEntry(false)));
|
||||
data.add(new CustomDataEntry("US.WV", "West Virginia", 2.4));
|
||||
data.add(new CustomDataEntry("US.DE", "Delaware", 13.5, new LabelDataEntry(false)));
|
||||
data.add(new CustomDataEntry("US.DC", "District of Columbia", 25.7, new LabelDataEntry(false)));
|
||||
data.add(new CustomDataEntry("US.MD", "Maryland", 8.9, new LabelDataEntry(false)));
|
||||
data.add(new CustomDataEntry("US.NJ", "New Jersey", 14.9, new LabelDataEntry(false)));
|
||||
data.add(new CustomDataEntry("US.NY", "New York", 11.9));
|
||||
data.add(new CustomDataEntry("US.PA", "Pennsylvania", 5.6));
|
||||
data.add(new CustomDataEntry("US.ME", "Maine", 10.4));
|
||||
data.add(new CustomDataEntry("US.HI", "Hawaii", 13.1));
|
||||
data.add(new CustomDataEntry("US.AK", "Alaska", 10.9));
|
||||
data.add(new CustomDataEntry("US.MI", "Michigan", 7.6));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
class CustomDataEntry extends DataEntry {
|
||||
public CustomDataEntry(String id, String name, Number value) {
|
||||
setValue("id", id);
|
||||
setValue("name", name);
|
||||
setValue("value", value);
|
||||
}
|
||||
public CustomDataEntry(String id, String name, Number value, LabelDataEntry label) {
|
||||
setValue("id", id);
|
||||
setValue("name", name);
|
||||
setValue("value", value);
|
||||
setValue("label", label);
|
||||
}
|
||||
}
|
||||
|
||||
class LabelDataEntry extends DataEntry {
|
||||
LabelDataEntry(Boolean enabled) {
|
||||
setValue("enabled", enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.SingleValueDataSet;
|
||||
import com.anychart.charts.CircularGauge;
|
||||
import com.anychart.core.axes.Circular;
|
||||
import com.anychart.core.gauge.pointers.Bar;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.graphics.vector.Fill;
|
||||
import com.anychart.graphics.vector.SolidFill;
|
||||
import com.anychart.graphics.vector.text.HAlign;
|
||||
import com.anychart.graphics.vector.text.VAlign;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
public class CircularGaugeActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
CircularGauge circularGauge = AnyChart.circular();
|
||||
circularGauge.data(new SingleValueDataSet(new String[] { "23", "34", "67", "93", "56", "100"}));
|
||||
circularGauge.fill("#fff")
|
||||
.stroke(null)
|
||||
.padding(0d, 0d, 0d, 0d)
|
||||
.margin(100d, 100d, 100d, 100d);
|
||||
circularGauge.startAngle(0d);
|
||||
circularGauge.sweepAngle(270d);
|
||||
|
||||
Circular xAxis = circularGauge.axis(0)
|
||||
.radius(100d)
|
||||
.width(1d)
|
||||
.fill((Fill) null);
|
||||
xAxis.scale()
|
||||
.minimum(0d)
|
||||
.maximum(100d);
|
||||
xAxis.ticks("{ interval: 1 }")
|
||||
.minorTicks("{ interval: 1 }");
|
||||
xAxis.labels().enabled(false);
|
||||
xAxis.ticks().enabled(false);
|
||||
xAxis.minorTicks().enabled(false);
|
||||
|
||||
circularGauge.label(0d)
|
||||
.text("Temazepam, <span style=\"\">32%</span>")
|
||||
.useHtml(true)
|
||||
.hAlign(HAlign.CENTER)
|
||||
.vAlign(VAlign.MIDDLE);
|
||||
circularGauge.label(0d)
|
||||
.anchor(Anchor.RIGHT_CENTER)
|
||||
.padding(0d, 10d, 0d, 0d)
|
||||
.height(17d / 2d + "%")
|
||||
.offsetY(100d + "%")
|
||||
.offsetX(0d);
|
||||
Bar bar0 = circularGauge.bar(0d);
|
||||
bar0.dataIndex(0d);
|
||||
bar0.radius(100d);
|
||||
bar0.width(17d);
|
||||
bar0.fill(new SolidFill("#64b5f6", 1d));
|
||||
bar0.stroke(null);
|
||||
bar0.zIndex(5d);
|
||||
Bar bar100 = circularGauge.bar(100d);
|
||||
bar100.dataIndex(5d);
|
||||
bar100.radius(100d);
|
||||
bar100.width(17d);
|
||||
bar100.fill(new SolidFill("#F5F4F4", 1d));
|
||||
bar100.stroke("1 #e5e4e4");
|
||||
bar100.zIndex(4d);
|
||||
|
||||
circularGauge.label(1d)
|
||||
.text("Guaifenesin, <span style=\"\">34%</span>")
|
||||
.useHtml(true)
|
||||
.hAlign(HAlign.CENTER)
|
||||
.vAlign(VAlign.MIDDLE);
|
||||
circularGauge.label(1d)
|
||||
.anchor(Anchor.RIGHT_CENTER)
|
||||
.padding(0d, 10d, 0d, 0d)
|
||||
.height(17d / 2d + "%")
|
||||
.offsetY(80d + "%")
|
||||
.offsetX(0d);
|
||||
Bar bar1 = circularGauge.bar(1d);
|
||||
bar1.dataIndex(1d);
|
||||
bar1.radius(80d);
|
||||
bar1.width(17d);
|
||||
bar1.fill(new SolidFill("#1976d2", 1d));
|
||||
bar1.stroke(null);
|
||||
bar1.zIndex(5d);
|
||||
Bar bar101 = circularGauge.bar(101d);
|
||||
bar101.dataIndex(5d);
|
||||
bar101.radius(80d);
|
||||
bar101.width(17d);
|
||||
bar101.fill(new SolidFill("#F5F4F4", 1d));
|
||||
bar101.stroke("1 #e5e4e4");
|
||||
bar101.zIndex(4d);
|
||||
|
||||
circularGauge.label(2d)
|
||||
.text("Salicylic Acid, <span style=\"\">67%</span>")
|
||||
.useHtml(true)
|
||||
.hAlign(HAlign.CENTER)
|
||||
.vAlign(VAlign.MIDDLE);
|
||||
circularGauge.label(2d)
|
||||
.anchor(Anchor.RIGHT_CENTER)
|
||||
.padding(0d, 10d, 0d, 0d)
|
||||
.height(17d / 2d + "%")
|
||||
.offsetY(60d + "%")
|
||||
.offsetX(0d);
|
||||
Bar bar2 = circularGauge.bar(2d);
|
||||
bar2.dataIndex(2d);
|
||||
bar2.radius(60d);
|
||||
bar2.width(17d);
|
||||
bar2.fill(new SolidFill("#ef6c00", 1d));
|
||||
bar2.stroke(null);
|
||||
bar2.zIndex(5d);
|
||||
Bar bar102 = circularGauge.bar(102d);
|
||||
bar102.dataIndex(5d);
|
||||
bar102.radius(60d);
|
||||
bar102.width(17d);
|
||||
bar102.fill(new SolidFill("#F5F4F4", 1d));
|
||||
bar102.stroke("1 #e5e4e4");
|
||||
bar102.zIndex(4d);
|
||||
|
||||
circularGauge.label(3d)
|
||||
.text("Fluoride, <span style=\"\">93%</span>")
|
||||
.useHtml(true)
|
||||
.hAlign(HAlign.CENTER)
|
||||
.vAlign(VAlign.MIDDLE);
|
||||
circularGauge.label(3d)
|
||||
.anchor(Anchor.RIGHT_CENTER)
|
||||
.padding(0d, 10d, 0d, 0d)
|
||||
.height(17d / 2d + "%")
|
||||
.offsetY(40d + "%")
|
||||
.offsetX(0d);
|
||||
Bar bar3 = circularGauge.bar(3d);
|
||||
bar3.dataIndex(3d);
|
||||
bar3.radius(40d);
|
||||
bar3.width(17d);
|
||||
bar3.fill(new SolidFill("#ffd54f", 1d));
|
||||
bar3.stroke(null);
|
||||
bar3.zIndex(5d);
|
||||
Bar bar103 = circularGauge.bar(103d);
|
||||
bar103.dataIndex(5d);
|
||||
bar103.radius(40d);
|
||||
bar103.width(17d);
|
||||
bar103.fill(new SolidFill("#F5F4F4", 1d));
|
||||
bar103.stroke("1 #e5e4e4");
|
||||
bar103.zIndex(4d);
|
||||
|
||||
circularGauge.label(4d)
|
||||
.text("Zinc Oxide, <span style=\"\">56%</span>")
|
||||
.useHtml(true)
|
||||
.hAlign(HAlign.CENTER)
|
||||
.vAlign(VAlign.MIDDLE);
|
||||
circularGauge.label(4d)
|
||||
.anchor(Anchor.RIGHT_CENTER)
|
||||
.padding(0d, 10d, 0d, 0d)
|
||||
.height(17d / 2d + "%")
|
||||
.offsetY(20d + "%")
|
||||
.offsetX(0d);
|
||||
Bar bar4 = circularGauge.bar(4d);
|
||||
bar4.dataIndex(4d);
|
||||
bar4.radius(20d);
|
||||
bar4.width(17d);
|
||||
bar4.fill(new SolidFill("#455a64", 1d));
|
||||
bar4.stroke(null);
|
||||
bar4.zIndex(5d);
|
||||
Bar bar104 = circularGauge.bar(104d);
|
||||
bar104.dataIndex(5d);
|
||||
bar104.radius(20d);
|
||||
bar104.width(17d);
|
||||
bar104.fill(new SolidFill("#F5F4F4", 1d));
|
||||
bar104.stroke("1 #e5e4e4");
|
||||
bar104.zIndex(4d);
|
||||
|
||||
circularGauge.margin(50d, 50d, 50d, 50d);
|
||||
circularGauge.title()
|
||||
.text("Medicine manufacturing progress' +\n" +
|
||||
" '<br/><span style=\"color:#929292; font-size: 12px;\">(ACME CORPORATION)</span>")
|
||||
.useHtml(true);
|
||||
circularGauge.title().enabled(true);
|
||||
circularGauge.title().hAlign(HAlign.CENTER);
|
||||
circularGauge.title()
|
||||
.padding(0d, 0d, 0d, 0d)
|
||||
.margin(0d, 0d, 20d, 0d);
|
||||
|
||||
anyChartView.setChart(circularGauge);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Cartesian3d;
|
||||
import com.anychart.core.cartesian.series.Column3d;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.HoverMode;
|
||||
import com.anychart.enums.ScaleStackMode;
|
||||
import com.anychart.enums.TooltipDisplayMode;
|
||||
import com.anychart.graphics.vector.SolidFill;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Column3DChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Cartesian3d column3d = AnyChart.column3d();
|
||||
|
||||
column3d.yScale().stackMode(ScaleStackMode.VALUE);
|
||||
|
||||
column3d.animation(true);
|
||||
|
||||
column3d.title("Types of Coffee");
|
||||
column3d.title().padding(0d, 0d, 15d, 0d);
|
||||
|
||||
List<DataEntry> seriesData = new ArrayList<>();
|
||||
seriesData.add(new CustomDataEntry("Espresso", 1, null, null, null, null, null));
|
||||
seriesData.add(new CustomDataEntry("Doppio", 2, null, null, null, null, null));
|
||||
seriesData.add(new CustomDataEntry("Trippio", 3, null, null, null, null, null));
|
||||
seriesData.add(new CustomDataEntry("Americano", 1, 3, null, null, null, null));
|
||||
seriesData.add(new CustomDataEntry("Cappuchino", 1, null, 1, 2, null, null));
|
||||
seriesData.add(new CustomDataEntry("Macchiato", 2.5, null, null, 1, null, null));
|
||||
seriesData.add(new CustomDataEntry("Latte", 1, null, 2, 1, null, null));
|
||||
seriesData.add(new CustomDataEntry("Latte Macchiato", 1, null, 2, null, 1, null));
|
||||
seriesData.add(new CustomDataEntry("Vienna Coffee", 1, null, null, null, 2, null));
|
||||
seriesData.add(new CustomDataEntry("Mocco", 1, null, 1, null, 1, 1));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(seriesData);
|
||||
Mapping series1Data = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping series2Data = set.mapAs("{ x: 'x', value: 'value2' }");
|
||||
Mapping series3Data = set.mapAs("{ x: 'x', value: 'value3' }");
|
||||
Mapping series4Data = set.mapAs("{ x: 'x', value: 'value4' }");
|
||||
Mapping series5Data = set.mapAs("{ x: 'x', value: 'value5' }");
|
||||
Mapping series6Data = set.mapAs("{ x: 'x', value: 'value6' }");
|
||||
|
||||
Column3d series1 = column3d.column(series1Data);
|
||||
series1.name("Espresso");
|
||||
series1.fill(new SolidFill("#3e2723", 1d));
|
||||
series1.stroke("1 #f7f3f3");
|
||||
series1.hovered().stroke("3 #f7f3f3");
|
||||
|
||||
Column3d series2 = column3d.column(series2Data);
|
||||
series2.name("Water");
|
||||
series2.fill(new SolidFill("#64b5f6", 1d));
|
||||
series2.stroke("1 #f7f3f3");
|
||||
series2.hovered().stroke("3 #f7f3f3");
|
||||
|
||||
Column3d series3 = column3d.column(series3Data);
|
||||
series3.name("Milk");
|
||||
series3.fill(new SolidFill("#fff3e0", 1d));
|
||||
series3.stroke("1 #f7f3f3");
|
||||
series3.hovered().stroke("3 #f7f3f3");
|
||||
|
||||
Column3d series4 = column3d.column(series4Data);
|
||||
series4.name("Steamed milk");
|
||||
series4.fill(new SolidFill("#bcaaa4", 1d));
|
||||
series4.stroke("1 #f7f3f3");
|
||||
series4.hovered().stroke("3 #f7f3f3");
|
||||
|
||||
Column3d series5 = column3d.column(series5Data);
|
||||
series5.name("Cream");
|
||||
series5.fill(new SolidFill("#e6c1b5", 1d));
|
||||
series5.stroke("1 #f7f3f3");
|
||||
series5.hovered().stroke("3 #f7f3f3");
|
||||
|
||||
Column3d series6 = column3d.column(series6Data);
|
||||
series6.name("Chocolate");
|
||||
series6.fill(new SolidFill("#bf360c", 1d));
|
||||
series6.stroke("1 #f7f3f3");
|
||||
series6.hovered().stroke("3 #f7f3f3");
|
||||
|
||||
column3d.legend().enabled(true);
|
||||
column3d.legend().fontSize(13d);
|
||||
column3d.legend().padding(0d, 0d, 20d, 0d);
|
||||
|
||||
column3d.yScale().ticks("[0, 1, 2, 3, 4, 5]");
|
||||
column3d.xAxis(0).stroke("1 #a18b7e");
|
||||
column3d.xAxis(0).labels().fontSize("#a18b7e");
|
||||
column3d.yAxis(0).stroke("1 #a18b7e");
|
||||
column3d.yAxis(0).labels().fontColor("#a18b7e");
|
||||
column3d.yAxis(0).labels().format("{%Value}{groupsSeparator: }");
|
||||
|
||||
column3d.yAxis(0).title().enabled(true);
|
||||
column3d.yAxis(0).title().text("Portions of Ingredients");
|
||||
column3d.yAxis(0).title().fontColor("#a18b7e");
|
||||
|
||||
column3d.interactivity().hoverMode(HoverMode.BY_X);
|
||||
|
||||
column3d.tooltip()
|
||||
.displayMode(TooltipDisplayMode.UNION)
|
||||
.format("{%Value} {%SeriesName}");
|
||||
|
||||
column3d.yGrid(0).stroke("#a18b7e", 1d, null, null, null);
|
||||
column3d.xGrid(0).stroke("#a18b7e", 1d, null, null, null);
|
||||
|
||||
anyChartView.setChart(column3d);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
CustomDataEntry(String x, Number value, Number value2, Number value3, Number value4, Number value5, Number value6) {
|
||||
super(x, value);
|
||||
setValue("value2", value2);
|
||||
setValue("value3", value3);
|
||||
setValue("value4", value4);
|
||||
setValue("value5", value5);
|
||||
setValue("value6", value6);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Cartesian;
|
||||
import com.anychart.core.cartesian.series.Column;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.enums.HoverMode;
|
||||
import com.anychart.enums.Position;
|
||||
import com.anychart.enums.TooltipPositionMode;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ColumnChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Cartesian cartesian = AnyChart.column();
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new ValueDataEntry("Rouge", 80540));
|
||||
data.add(new ValueDataEntry("Foundation", 94190));
|
||||
data.add(new ValueDataEntry("Mascara", 102610));
|
||||
data.add(new ValueDataEntry("Lip gloss", 110430));
|
||||
data.add(new ValueDataEntry("Lipstick", 128000));
|
||||
data.add(new ValueDataEntry("Nail polish", 143760));
|
||||
data.add(new ValueDataEntry("Eyebrow pencil", 170670));
|
||||
data.add(new ValueDataEntry("Eyeliner", 213210));
|
||||
data.add(new ValueDataEntry("Eyeshadows", 249980));
|
||||
|
||||
Column column = cartesian.column(data);
|
||||
|
||||
column.tooltip()
|
||||
.titleFormat("{%X}")
|
||||
.position(Position.CENTER_BOTTOM)
|
||||
.anchor(Anchor.CENTER_BOTTOM)
|
||||
.offsetX(0d)
|
||||
.offsetY(5d)
|
||||
.format("${%Value}{groupsSeparator: }");
|
||||
|
||||
cartesian.animation(true);
|
||||
cartesian.title("Top 10 Cosmetic Products by Revenue");
|
||||
|
||||
cartesian.yScale().minimum(0d);
|
||||
|
||||
cartesian.yAxis(0).labels().format("${%Value}{groupsSeparator: }");
|
||||
|
||||
cartesian.tooltip().positionMode(TooltipPositionMode.POINT);
|
||||
cartesian.interactivity().hoverMode(HoverMode.BY_X);
|
||||
|
||||
cartesian.xAxis(0).title("Product");
|
||||
cartesian.yAxis(0).title("Revenue");
|
||||
|
||||
anyChartView.setChart(cartesian);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Cartesian;
|
||||
import com.anychart.core.cartesian.series.Line;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.Orientation;
|
||||
import com.anychart.enums.ScaleStackMode;
|
||||
import com.anychart.sample.R;
|
||||
import com.anychart.scales.Linear;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CombinedChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Cartesian cartesian = AnyChart.cartesian();
|
||||
|
||||
cartesian.animation(true);
|
||||
|
||||
cartesian.title("Combination of Stacked Column and Line Chart (Dual Y-Axis)");
|
||||
|
||||
cartesian.yScale().stackMode(ScaleStackMode.VALUE);
|
||||
|
||||
Linear scalesLinear = Linear.instantiate();
|
||||
scalesLinear.minimum(0d);
|
||||
scalesLinear.maximum(100d);
|
||||
scalesLinear.ticks("{ interval: 20 }");
|
||||
|
||||
com.anychart.core.axes.Linear extraYAxis = cartesian.yAxis(1d);
|
||||
extraYAxis.orientation(Orientation.RIGHT)
|
||||
.scale(scalesLinear);
|
||||
extraYAxis.labels()
|
||||
.padding(0d, 0d, 0d, 5d)
|
||||
.format("{%Value}%");
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomDataEntry("P1", 96.5, 2040, 1200, 1600));
|
||||
data.add(new CustomDataEntry("P2", 77.1, 1794, 1124, 1724));
|
||||
data.add(new CustomDataEntry("P3", 73.2, 2026, 1006, 1806));
|
||||
data.add(new CustomDataEntry("P4", 61.1, 2341, 921, 1621));
|
||||
data.add(new CustomDataEntry("P5", 70.0, 1800, 1500, 1700));
|
||||
data.add(new CustomDataEntry("P6", 60.7, 1507, 1007, 1907));
|
||||
data.add(new CustomDataEntry("P7", 62.1, 2701, 921, 1821));
|
||||
data.add(new CustomDataEntry("P8", 75.1, 1671, 971, 1671));
|
||||
data.add(new CustomDataEntry("P9", 80.0, 1980, 1080, 1880));
|
||||
data.add(new CustomDataEntry("P10", 54.1, 1041, 1041, 1641));
|
||||
data.add(new CustomDataEntry("P11", 51.3, 813, 1113, 1913));
|
||||
data.add(new CustomDataEntry("P12", 59.1, 691, 1091, 1691));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(data);
|
||||
Mapping lineData = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping column1Data = set.mapAs("{ x: 'x', value: 'value2' }");
|
||||
Mapping column2Data = set.mapAs("{ x: 'x', value: 'value3' }");
|
||||
Mapping column3Data = set.mapAs("{ x: 'x', value: 'value4' }");
|
||||
|
||||
cartesian.column(column1Data);
|
||||
cartesian.crosshair(true);
|
||||
|
||||
Line line = cartesian.line(lineData);
|
||||
line.yScale(scalesLinear);
|
||||
|
||||
cartesian.column(column2Data);
|
||||
|
||||
cartesian.column(column3Data);
|
||||
|
||||
anyChartView.setChart(cartesian);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
CustomDataEntry(String x, Number value, Number value2, Number value3, Number value4) {
|
||||
super(x, value);
|
||||
setValue("value2", value2);
|
||||
setValue("value3", value3);
|
||||
setValue("value4", value4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.charts.Map;
|
||||
import com.anychart.core.map.series.Connector;
|
||||
import com.anychart.core.map.series.Marker;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.enums.MarkerType;
|
||||
import com.anychart.enums.SelectionMode;
|
||||
import com.anychart.graphics.vector.SolidFill;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ConnectorMapActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Map map = AnyChart.connector();
|
||||
|
||||
map.unboundRegions()
|
||||
.enabled(true)
|
||||
.fill(new SolidFill("#E1E1E1", 1))
|
||||
.stroke("1 #D2D2D2");
|
||||
|
||||
map.geoData("anychart.maps.united_kingdom");
|
||||
map.interactivity().selectionMode(SelectionMode.NONE);
|
||||
|
||||
map.title().enabled(true);
|
||||
map.title().useHtml(true);
|
||||
map.title().text("Journey Route: the United Kingdom Roundtrip<br/>" +
|
||||
" <span style=\"color:#212121; font-size: 13px;\">Example shows sample of usage a multistage connector.<br/>" +
|
||||
" All data are fictitious.</span>");
|
||||
|
||||
Connector connectorSeries = map.connector(getCarData());
|
||||
connectorSeries.startSize(0)
|
||||
.endSize(0)
|
||||
.stroke("2 #64b5f6")
|
||||
.name("Rent a Car");
|
||||
connectorSeries.curvature(0);
|
||||
connectorSeries.legendItem("{" +
|
||||
" iconType: 'circle'," +
|
||||
" fill: '#64b5f6'," +
|
||||
" iconStroke: '2 #E1E1E1'" +
|
||||
" }");
|
||||
connectorSeries.hovered().stroke("1.5 #212121");
|
||||
|
||||
connectorSeries.tooltip()
|
||||
.padding(8, 13, 10, 13)
|
||||
.fontSize(12)
|
||||
.fontColor("#fff")
|
||||
.format("{%full}")
|
||||
.titleFormat("{%number}. <span style=\"font-size: 13px; color: #E1E1E1\">{%short}</span>")
|
||||
.useHtml(true);
|
||||
|
||||
connectorSeries = map.connector(getShipData());
|
||||
connectorSeries.startSize(0)
|
||||
.endSize(0)
|
||||
.stroke("2 #1976d2")
|
||||
.name("Ferry");
|
||||
connectorSeries.curvature(0);
|
||||
connectorSeries.legendItem("{\n" +
|
||||
" iconType: 'circle',\n" +
|
||||
" fill: '#1976d2',\n" +
|
||||
" iconStroke: '2 #E1E1E1'\n" +
|
||||
" }");
|
||||
connectorSeries.hovered().stroke("1.5 #212121");
|
||||
|
||||
connectorSeries.tooltip()
|
||||
.padding(8, 13, 10, 13)
|
||||
.fontSize(12)
|
||||
.fontColor("#fff")
|
||||
.format("{%full}")
|
||||
.titleFormat("{%number}. <span style=\"font-size: 13px; color: #E1E1E1\">{%short}</span>")
|
||||
.useHtml(true);
|
||||
|
||||
connectorSeries = map.connector(getAirData());
|
||||
connectorSeries.startSize(0)
|
||||
.endSize(0)
|
||||
.stroke("2 #ef6c00")
|
||||
.name("Airplane");
|
||||
connectorSeries.curvature(0);
|
||||
connectorSeries.legendItem("{\n" +
|
||||
" iconType: 'circle',\n" +
|
||||
" fill: '#ef6c00',\n" +
|
||||
" iconStroke: '2 #E1E1E1'\n" +
|
||||
" }");
|
||||
connectorSeries.hovered().stroke("1.5 #212121");
|
||||
|
||||
connectorSeries.tooltip()
|
||||
.padding(8, 13, 10, 13)
|
||||
.fontSize(12)
|
||||
.fontColor("#fff")
|
||||
.format("{%full}")
|
||||
.titleFormat("{%number}. <span style=\"font-size: 13px; color: #E1E1E1\">{%short}</span>")
|
||||
.useHtml(true);
|
||||
|
||||
map.legend(true);
|
||||
|
||||
Marker citiesSeries = map.marker(getCitiesData());
|
||||
citiesSeries.type(MarkerType.CIRCLE)
|
||||
.size(4)
|
||||
.fill(new SolidFill("#64b5f6", 1))
|
||||
.stroke("2 #E1E1E1")
|
||||
.tooltip(false);
|
||||
//
|
||||
citiesSeries.hovered()
|
||||
.size(4)
|
||||
.fill(new SolidFill("#64b5f6", 1))
|
||||
.stroke("2 #E1E1E1");
|
||||
|
||||
citiesSeries.labels().enabled(true);
|
||||
citiesSeries.labels().position("center-bottom");
|
||||
citiesSeries.labels().fontColor("#263238");
|
||||
citiesSeries.labels()
|
||||
.offsetX(5)
|
||||
.offsetY(0)
|
||||
.anchor(Anchor.LEFT_CENTER)
|
||||
.format("{%name}");
|
||||
|
||||
citiesSeries.legendItem().enabled(false);
|
||||
|
||||
anyChartView.addScript("file:///android_asset/united_kingdom.js");
|
||||
anyChartView.addScript("file:///android_asset/proj4.js");
|
||||
anyChartView.setChart(map);
|
||||
}
|
||||
|
||||
private List<DataEntry> getCitiesData() {
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
|
||||
data.add(new CitiesDataEntry(51.507315, -0.127901, "London"));
|
||||
data.add(new CitiesDataEntry(50.908579, -1.404370, "Southampton", new LabelDataEntry(10, "#7c868e")));
|
||||
data.add(new CitiesDataEntry(51.453568, -2.588353, "Bristol"));
|
||||
data.add(new CitiesDataEntry(52.484899, -1.890637, "Birmingham", new LabelDataEntry("right", 10, "#7c868e")));
|
||||
data.add(new CitiesDataEntry(53.474881, -2.249000, "Manchester", new LabelDataEntry("rightTop", 0, 3)));
|
||||
data.add(new CitiesDataEntry(53.403105, -2.999768, "Liverpool", new LabelDataEntry("right")));
|
||||
data.add(new CitiesDataEntry(53.812012, -3.053354, "Blackpool", new LabelDataEntry("topRight", 10, "#7c868e", 0, -5)));
|
||||
data.add(new CitiesDataEntry(54.151732, -4.486070, "Douglas", new LabelDataEntry("rightTop", 10, "#7c868e", 0, -3)));
|
||||
data.add(new CitiesDataEntry(54.614223, -5.912609, "Belfast", "#1976d2"));
|
||||
data.add(new CitiesDataEntry(54.994887, -7.309736, "Derry", new LabelDataEntry("right", 10, "#7c868e"), "#ef6c00"));
|
||||
data.add(new CitiesDataEntry(57.475560, -4.224776, "Inverness", "#ef6c00"));
|
||||
data.add(new CitiesDataEntry(57.148309, -2.094987, "Aberdeen", new LabelDataEntry(10, "#7c868e")));
|
||||
data.add(new CitiesDataEntry(56.460279, -2.965115, "Dundee", new LabelDataEntry(10, "#7c868e")));
|
||||
data.add(new CitiesDataEntry(56.069916, -3.450884, "Dunfermline", new LabelDataEntry("right", 10, "#7c868e")));
|
||||
data.add(new CitiesDataEntry(55.946814, -3.184442, "Edinburgh"));
|
||||
data.add(new CitiesDataEntry(54.977230, -1.617702, "Newcastle upon Tyne", new LabelDataEntry(10, "#7c868e")));
|
||||
data.add(new CitiesDataEntry(53.799611, -1.549131, "Leeds", new LabelDataEntry("leftTop")));
|
||||
data.add(new CitiesDataEntry(53.234525, -1.421464, "Chesterfield", new LabelDataEntry(10, "#7c868e")));
|
||||
data.add(new CitiesDataEntry(52.954190, -1.158432, "Nottingham", new LabelDataEntry(10, "#7c868e")));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private List<DataEntry> getAirData() {
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
|
||||
data.add(new CustomDataEntry(new Number[]{ 54.614223, -5.912609, 54.994887, -7.309736, 57.475560, -4.224776 }, 5, "Flight from Belfast to Inverness", "There was not any planes from Belfast to Inverness.\\nSo we had to flight through Derry.", 0));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private List<DataEntry> getShipData() {
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
|
||||
data.add(new CustomDataEntry(new Number[]{ 53.403105, -2.999768, 53.812012, -3.053354, 54.151732, -4.486070, 54.614223, -5.912609 }, 4, "From Liverpool to Belfast by boat", "To get from Liverpool to Belfast, we got tickets on a cruise ship.\\nThe route of the cruise ship went through Blackpool and Douglas\\nand took 3 days.", 0));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private List<DataEntry> getCarData() {
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
|
||||
data.add(new CustomDataEntry(new Number[]{ 51.507315, -0.127901, 50.908579, -1.404370, 51.453568, -2.588353 }, 1, "From London to Bristol", "On our way to Bristol we stopped in Southampton\\nand enjoyed the dinner at restaurant."));
|
||||
data.add(new CustomDataEntry(new Number[]{ 51.453568, -2.588353, 52.484899, -1.890637, 53.474881, -2.249000 }, 2, "From Bristol to Manchester", "On our way to Manchester we stopped in Birmingham\\nfor one night to have some rest and to walk in Birmingham\\'s\\ncity center."));
|
||||
data.add(new CustomDataEntry(new Number[]{ 53.474881, -2.249000, 53.403105, -2.999768 }, 3, "From Manchester to Liverpool", "The road to Liverpool took just couple of hours,\\nso we had plenty time to walk around in Liverpool."));
|
||||
data.add(new CustomDataEntry(new Number[]{ 57.475560, -4.224776, 57.148309, -2.094987, 56.460279, -2.965115, 56.069916, -3.450884, 55.946814, -3.184442 }, 6, "From Inverness to Edinburgh", "That was really nice journey though Scotland.\\nWe stopped a lot and we met a lot of nice people.\\nthe journey took us 3 days."));
|
||||
data.add(new CustomDataEntry(new Number[]{ 55.946814, -3.184442, 54.977230, -1.617702, 53.799611, -1.549131 }, 7, "From Edinburgh to Leeds", "On our way from Edinburgh to Leeds we stopped only once\\nin beautiful city Newcastle upon Tyne."));
|
||||
data.add(new CustomDataEntry(new Number[]{ 53.799611, -1.549131, 53.234525, -1.421464, 52.954190, -1.158432, 51.507315, -0.127901 }, 8, "From Leeds back to London", "On our way back to London from Leeds\\nwe made several stops. And we spent a night\\nin Nottingham. This part took us three days."));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends DataEntry {
|
||||
public CustomDataEntry(Number[] points, Integer number, String shortDescription, String fullDescription) {
|
||||
setValue("points", points);
|
||||
setValue("number", number);
|
||||
setValue("short", shortDescription);
|
||||
setValue("full", fullDescription);
|
||||
}
|
||||
|
||||
public CustomDataEntry(Number[] points, Integer number, String shortDescription, String fullDescription, Integer curvature) {
|
||||
setValue("points", points);
|
||||
setValue("number", number);
|
||||
setValue("short", shortDescription);
|
||||
setValue("full", fullDescription);
|
||||
setValue("curvature", curvature);
|
||||
}
|
||||
}
|
||||
|
||||
private class CitiesDataEntry extends DataEntry {
|
||||
public CitiesDataEntry(Number latitude, Number longitude, String name) {
|
||||
setValue("lat", latitude);
|
||||
setValue("long", longitude);
|
||||
setValue("name", name);
|
||||
}
|
||||
public CitiesDataEntry(Number latitude, Number longitude, String name, String fill) {
|
||||
setValue("lat", latitude);
|
||||
setValue("long", longitude);
|
||||
setValue("name", name);
|
||||
setValue("fill", fill);
|
||||
}
|
||||
public CitiesDataEntry(Number latitude, Number longitude, String name, LabelDataEntry label) {
|
||||
setValue("lat", latitude);
|
||||
setValue("long", longitude);
|
||||
setValue("name", name);
|
||||
setValue("label", label);
|
||||
}
|
||||
public CitiesDataEntry(Number latitude, Number longitude, String name, LabelDataEntry label, String fill) {
|
||||
setValue("lat", latitude);
|
||||
setValue("long", longitude);
|
||||
setValue("name", name);
|
||||
setValue("label", label);
|
||||
setValue("fill", fill);
|
||||
}
|
||||
}
|
||||
|
||||
private class LabelDataEntry extends DataEntry {
|
||||
public LabelDataEntry(Integer fontSize, String fontColor) {
|
||||
setValue("fontSize", fontSize);
|
||||
setValue("fontColor", fontColor);
|
||||
}
|
||||
public LabelDataEntry(String anchor, Integer fontSize, String fontColor) {
|
||||
setValue("anchor", anchor);
|
||||
setValue("fontSize", fontSize);
|
||||
setValue("fontColor", fontColor);
|
||||
}
|
||||
public LabelDataEntry(String anchor, Integer offsetX, Integer offsetY) {
|
||||
setValue("right", anchor);
|
||||
setValue("offsetX", offsetX);
|
||||
setValue("offsetY", offsetY);
|
||||
}
|
||||
public LabelDataEntry(String anchor) {
|
||||
setValue("anchor", anchor);
|
||||
}
|
||||
public LabelDataEntry(String anchor, Integer fontSize, String fontColor, Integer offsetX, Integer offsetY) {
|
||||
setValue("anchor", anchor);
|
||||
setValue("fontSize", fontSize);
|
||||
setValue("fontColor", fontColor);
|
||||
setValue("offsetX", offsetX);
|
||||
setValue("offsetY", offsetY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Funnel;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FunnelChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Funnel funnel = AnyChart.funnel();
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new ValueDataEntry("Website Visits", 528756));
|
||||
data.add(new ValueDataEntry("Downloads", 164052));
|
||||
data.add(new ValueDataEntry("Valid Contacts", 112167));
|
||||
data.add(new ValueDataEntry("Interested to Buy", 79128));
|
||||
data.add(new ValueDataEntry("Purchased", 79128));
|
||||
|
||||
funnel.data(data);
|
||||
|
||||
funnel.margin(new String[] { "10", "20%", "10", "20%" });
|
||||
funnel.baseWidth("70%")
|
||||
.neckWidth("17%");
|
||||
|
||||
funnel.labels()
|
||||
.position("outsideleft")
|
||||
.format("{%X} - {%Value}");
|
||||
|
||||
funnel.animation(true);
|
||||
|
||||
anyChartView.setChart(funnel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.charts.Gantt;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
public class GanttChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Gantt gantt = AnyChart.ganttProject();
|
||||
gantt.splitterPosition(320d);
|
||||
|
||||
anyChartView.setChart(gantt);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.HeatDataEntry;
|
||||
import com.anychart.charts.HeatMap;
|
||||
import com.anychart.enums.SelectionMode;
|
||||
import com.anychart.graphics.vector.SolidFill;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HeatMapChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
HeatMap riskMap = AnyChart.heatMap();
|
||||
|
||||
riskMap.stroke("1 #fff");
|
||||
riskMap.hovered()
|
||||
.stroke("6 #fff")
|
||||
.fill(new SolidFill("#545f69", 1d))
|
||||
.labels("{ fontColor: '#fff' }");
|
||||
|
||||
riskMap.interactivity().selectionMode(SelectionMode.NONE);
|
||||
|
||||
riskMap.title().enabled(true);
|
||||
riskMap.title()
|
||||
.text("Risk Matrix in Project Server")
|
||||
.padding(0d, 0d, 20d, 0d);
|
||||
|
||||
riskMap.labels().enabled(true);
|
||||
riskMap.labels()
|
||||
.minFontSize(14d)
|
||||
.format("function() {\n" +
|
||||
" var namesList = [\"Low\", \"Medium\", \"High\", \"Extreme\"];\n" +
|
||||
" return namesList[this.heat];\n" +
|
||||
" }");
|
||||
|
||||
riskMap.yAxis(0).stroke(null);
|
||||
riskMap.yAxis(0).labels().padding(0d, 15d, 0d, 0d);
|
||||
riskMap.yAxis(0).ticks(false);
|
||||
riskMap.xAxis(0).stroke(null);
|
||||
riskMap.xAxis(0).ticks(false);
|
||||
|
||||
riskMap.tooltip().title().useHtml(true);
|
||||
riskMap.tooltip()
|
||||
.useHtml(true)
|
||||
.titleFormat("function() {\n" +
|
||||
" var namesList = [\"Low\", \"Medium\", \"High\", \"Extreme\"];\n" +
|
||||
" return '<b>' + namesList[this.heat] + '</b> Residual Risk';\n" +
|
||||
" }")
|
||||
.format("function () {\n" +
|
||||
" return '<span style=\"color: #CECECE\">Likelihood: </span>' + this.x + '<br/>' +\n" +
|
||||
" '<span style=\"color: #CECECE\">Consequence: </span>' + this.y;\n" +
|
||||
" }");
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomHeatDataEntry("Rare", "Insignificant", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Rare", "Minor", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Rare", "Moderate", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Rare", "Major", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Rare", "Extreme", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Unlikely", "Insignificant", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Unlikely", "Minor", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Unlikely", "Moderate", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Unlikely", "Major", 1, "#ffb74d"));
|
||||
data.add(new CustomHeatDataEntry("Unlikely", "Extreme", 1, "#ffb74d"));
|
||||
data.add(new CustomHeatDataEntry("Possible", "Insignificant", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Possible", "Minor", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Possible", "Moderate", 1, "#ffb74d"));
|
||||
data.add(new CustomHeatDataEntry("Possible", "Major", 1, "#ffb74d"));
|
||||
data.add(new CustomHeatDataEntry("Possible", "Extreme", 1, "#ffb74d"));
|
||||
data.add(new CustomHeatDataEntry("Likely", "Insignificant", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Likely", "Minor", 1, "#ffb74d"));
|
||||
data.add(new CustomHeatDataEntry("Likely", "Moderate", 1, "#ffb74d"));
|
||||
data.add(new CustomHeatDataEntry("Likely", "Major", 2, "#ef6c00"));
|
||||
data.add(new CustomHeatDataEntry("Likely", "Extreme", 2, "#ef6c00"));
|
||||
data.add(new CustomHeatDataEntry("Almost\\nCertain", "Insignificant", 0, "#90caf9"));
|
||||
data.add(new CustomHeatDataEntry("Almost\\nCertain", "Minor", 1, "#ffb74d"));
|
||||
data.add(new CustomHeatDataEntry("Almost\\nCertain", "Moderate", 1, "#ffb74d"));
|
||||
data.add(new CustomHeatDataEntry("Almost\\nCertain", "Major", 2, "#ef6c00"));
|
||||
data.add(new CustomHeatDataEntry("Almost\\nCertain", "Extreme", 3, "#d84315"));
|
||||
|
||||
riskMap.data(data);
|
||||
|
||||
|
||||
anyChartView.setChart(riskMap);
|
||||
}
|
||||
|
||||
private class CustomHeatDataEntry extends HeatDataEntry {
|
||||
CustomHeatDataEntry(String x, String y, Integer heat, String fill) {
|
||||
super(x, y, heat);
|
||||
setValue("fill", fill);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.HighLowDataEntry;
|
||||
import com.anychart.charts.Stock;
|
||||
import com.anychart.core.stock.Plot;
|
||||
import com.anychart.core.stock.series.Hilo;
|
||||
import com.anychart.data.Table;
|
||||
import com.anychart.data.TableMapping;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HiloChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Stock stock = AnyChart.stock();
|
||||
|
||||
Plot plot = stock.plot(0);
|
||||
|
||||
plot.yGrid(true)
|
||||
.yMinorGrid(true);
|
||||
|
||||
Table table = Table.instantiate("x");
|
||||
table.addData(getData());
|
||||
TableMapping mapping = table.mapAs("{'high': 'high', 'low': 'low'}");
|
||||
|
||||
Hilo hilo = plot.hilo(mapping);
|
||||
hilo.name("Temperature");
|
||||
|
||||
hilo.tooltip().format("Max: {%High}°<br/>Min: {%Low}°");
|
||||
stock.tooltip().useHtml(true);
|
||||
|
||||
anyChartView.setChart(stock);
|
||||
}
|
||||
|
||||
private List<DataEntry> getData() {
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new HighLowDataEntry(1136044800000L,10,6));
|
||||
data.add(new HighLowDataEntry(1136131200000L,9.4,2.6));
|
||||
data.add(new HighLowDataEntry(1136217600000L,7.4,2.2));
|
||||
data.add(new HighLowDataEntry(1136304000000L,10.3,4.5));
|
||||
data.add(new HighLowDataEntry(1136390400000L,10.8,6.8));
|
||||
data.add(new HighLowDataEntry(1136476800000L,12.8,7.7));
|
||||
data.add(new HighLowDataEntry(1136563200000L,9.1,6.9));
|
||||
data.add(new HighLowDataEntry(1136649600000L,7.8,1.7));
|
||||
data.add(new HighLowDataEntry(1136736000000L,8.5,6));
|
||||
data.add(new HighLowDataEntry(1136822400000L,7.7,5.3));
|
||||
data.add(new HighLowDataEntry(1136908800000L,8.5,4.4));
|
||||
data.add(new HighLowDataEntry(1136995200000L,7.3,3.1));
|
||||
data.add(new HighLowDataEntry(1137081600000L,8.8,5.5));
|
||||
data.add(new HighLowDataEntry(1137168000000L,8.1,3.3));
|
||||
data.add(new HighLowDataEntry(1137254400000L,8,-0.7));
|
||||
data.add(new HighLowDataEntry(1137340800000L,8.5,3.2));
|
||||
data.add(new HighLowDataEntry(1137427200000L,10,5.8));
|
||||
data.add(new HighLowDataEntry(1137513600000L,8,4.8));
|
||||
data.add(new HighLowDataEntry(1137600000000L,7.1,3.6));
|
||||
data.add(new HighLowDataEntry(1137686400000L,7.4,1.5));
|
||||
data.add(new HighLowDataEntry(1137772800000L,5.7,3.5));
|
||||
data.add(new HighLowDataEntry(1137859200000L,8,4.7));
|
||||
data.add(new HighLowDataEntry(1137945600000L,8.7,5.5));
|
||||
data.add(new HighLowDataEntry(1138032000000L,10.4,2.5));
|
||||
data.add(new HighLowDataEntry(1138118400000L,9.5,2.8));
|
||||
data.add(new HighLowDataEntry(1138204800000L,7.7,5.1));
|
||||
data.add(new HighLowDataEntry(1138291200000L,6.9,2.8));
|
||||
data.add(new HighLowDataEntry(1138377600000L,7.8,2.6));
|
||||
data.add(new HighLowDataEntry(1138464000000L,6.3,1.3));
|
||||
data.add(new HighLowDataEntry(1138550400000L,11.5,5.3));
|
||||
data.add(new HighLowDataEntry(1138636800000L,7.9,3.3));
|
||||
data.add(new HighLowDataEntry(1138723200000L,9.1,6.2));
|
||||
data.add(new HighLowDataEntry(1138809600000L,10.4,4.8));
|
||||
data.add(new HighLowDataEntry(1138896000000L,8.4,3.5));
|
||||
data.add(new HighLowDataEntry(1138982400000L,9.9,6.5));
|
||||
data.add(new HighLowDataEntry(1139068800000L,8.4,2.6));
|
||||
data.add(new HighLowDataEntry(1139155200000L,7.6,2.6));
|
||||
data.add(new HighLowDataEntry(1139241600000L,11.2,2.2));
|
||||
data.add(new HighLowDataEntry(1139328000000L,8.4,3.7));
|
||||
data.add(new HighLowDataEntry(1139414400000L,8.4,-1));
|
||||
data.add(new HighLowDataEntry(1139500800000L,9.6,-1.9));
|
||||
data.add(new HighLowDataEntry(1139587200000L,9.3,-1.9));
|
||||
data.add(new HighLowDataEntry(1139673600000L,11.3,1.9));
|
||||
data.add(new HighLowDataEntry(1139760000000L,8,4.4));
|
||||
data.add(new HighLowDataEntry(1139846400000L,6.2,-1));
|
||||
data.add(new HighLowDataEntry(1139932800000L,6.5,-3.7));
|
||||
data.add(new HighLowDataEntry(1140019200000L,6.9,-2.8));
|
||||
data.add(new HighLowDataEntry(1140105600000L,5.5,-3.2));
|
||||
data.add(new HighLowDataEntry(1140192000000L,5.6,-4.9));
|
||||
data.add(new HighLowDataEntry(1140278400000L,5.2,-5.2));
|
||||
data.add(new HighLowDataEntry(1140364800000L,4.8,-2.3));
|
||||
data.add(new HighLowDataEntry(1140451200000L,6.6,2));
|
||||
data.add(new HighLowDataEntry(1140537600000L,8.1,1.3));
|
||||
data.add(new HighLowDataEntry(1140624000000L,6.9,2.4));
|
||||
data.add(new HighLowDataEntry(1140710400000L,5,-3.9));
|
||||
data.add(new HighLowDataEntry(1140796800000L,4.1,-2.8));
|
||||
data.add(new HighLowDataEntry(1140883200000L,7.6,1.5));
|
||||
data.add(new HighLowDataEntry(1140969600000L,12,4.2));
|
||||
data.add(new HighLowDataEntry(1141056000000L,8.7,3.4));
|
||||
data.add(new HighLowDataEntry(1141142400000L,11.4,1.6));
|
||||
data.add(new HighLowDataEntry(1141228800000L,12.2,3.6));
|
||||
data.add(new HighLowDataEntry(1141315200000L,8.1,-1));
|
||||
data.add(new HighLowDataEntry(1141401600000L,11.2,3.3));
|
||||
data.add(new HighLowDataEntry(1141488000000L,10.7,1.4));
|
||||
data.add(new HighLowDataEntry(1141574400000L,13,5.4));
|
||||
data.add(new HighLowDataEntry(1141660800000L,9.1,4));
|
||||
data.add(new HighLowDataEntry(1141747200000L,7.3,0.9));
|
||||
data.add(new HighLowDataEntry(1141833600000L,5.7,0.4));
|
||||
data.add(new HighLowDataEntry(1141920000000L,8.3,0.2));
|
||||
data.add(new HighLowDataEntry(1142006400000L,7.5,-2.8));
|
||||
data.add(new HighLowDataEntry(1142092800000L,8.1,-2.6));
|
||||
data.add(new HighLowDataEntry(1142179200000L,10.8,-1.1));
|
||||
data.add(new HighLowDataEntry(1142265600000L,10.6,3.5));
|
||||
data.add(new HighLowDataEntry(1142352000000L,8.8,4.7));
|
||||
data.add(new HighLowDataEntry(1142438400000L,9.4,3.2));
|
||||
data.add(new HighLowDataEntry(1142524800000L,9.7,2));
|
||||
data.add(new HighLowDataEntry(1142611200000L,8,2.4));
|
||||
data.add(new HighLowDataEntry(1142697600000L,8.9,-1.8));
|
||||
data.add(new HighLowDataEntry(1142784000000L,11,-0.7));
|
||||
data.add(new HighLowDataEntry(1142870400000L,10.2,5.7));
|
||||
data.add(new HighLowDataEntry(1142956800000L,10.4,7.8));
|
||||
data.add(new HighLowDataEntry(1143043200000L,15.9,6.5));
|
||||
data.add(new HighLowDataEntry(1143129600000L,12.8,7.3));
|
||||
data.add(new HighLowDataEntry(1143216000000L,9.8,2.7));
|
||||
data.add(new HighLowDataEntry(1143302400000L,8.5,2.2));
|
||||
data.add(new HighLowDataEntry(1143388800000L,10.9,3.4));
|
||||
data.add(new HighLowDataEntry(1143475200000L,11.2,5.6));
|
||||
data.add(new HighLowDataEntry(1143561600000L,13.4,2.7));
|
||||
data.add(new HighLowDataEntry(1143648000000L,13.8,6.6));
|
||||
data.add(new HighLowDataEntry(1143734400000L,13.1,6.9));
|
||||
data.add(new HighLowDataEntry(1143820800000L,8.2,5.4));
|
||||
data.add(new HighLowDataEntry(1143907200000L,16.4,4.1));
|
||||
data.add(new HighLowDataEntry(1143993600000L,10.9,4.4));
|
||||
data.add(new HighLowDataEntry(1144080000000L,12.4,6.9));
|
||||
data.add(new HighLowDataEntry(1144166400000L,13.7,4.3));
|
||||
data.add(new HighLowDataEntry(1144252800000L,13.3,3.9));
|
||||
data.add(new HighLowDataEntry(1144339200000L,12.5,5.4));
|
||||
data.add(new HighLowDataEntry(1144425600000L,13.7,8.4));
|
||||
data.add(new HighLowDataEntry(1144512000000L,11,7.3));
|
||||
data.add(new HighLowDataEntry(1144598400000L,13.1,7.5));
|
||||
data.add(new HighLowDataEntry(1144684800000L,12.9,4.9));
|
||||
data.add(new HighLowDataEntry(1144771200000L,13.2,7.2));
|
||||
data.add(new HighLowDataEntry(1144857600000L,8.9,5.9));
|
||||
data.add(new HighLowDataEntry(1144944000000L,10.5,6.2));
|
||||
data.add(new HighLowDataEntry(1145030400000L,8.5,2.5));
|
||||
data.add(new HighLowDataEntry(1145116800000L,11.5,4.7));
|
||||
data.add(new HighLowDataEntry(1145203200000L,12.8,2));
|
||||
data.add(new HighLowDataEntry(1145289600000L,12.8,5.9));
|
||||
data.add(new HighLowDataEntry(1145376000000L,12.8,8.2));
|
||||
data.add(new HighLowDataEntry(1145462400000L,12.3,8));
|
||||
data.add(new HighLowDataEntry(1145548800000L,11.3,5.5));
|
||||
data.add(new HighLowDataEntry(1145635200000L,12.5,2.4));
|
||||
data.add(new HighLowDataEntry(1145721600000L,16.1,4.4));
|
||||
data.add(new HighLowDataEntry(1145808000000L,16.1,5.5));
|
||||
data.add(new HighLowDataEntry(1145894400000L,17.1,7));
|
||||
data.add(new HighLowDataEntry(1145980800000L,12,7.4));
|
||||
data.add(new HighLowDataEntry(1146067200000L,14.5,8.4));
|
||||
data.add(new HighLowDataEntry(1146153600000L,18,6));
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Cartesian;
|
||||
import com.anychart.core.cartesian.series.Line;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.enums.MarkerType;
|
||||
import com.anychart.enums.TooltipPositionMode;
|
||||
import com.anychart.graphics.vector.Stroke;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LineChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Cartesian cartesian = AnyChart.line();
|
||||
|
||||
cartesian.animation(true);
|
||||
|
||||
cartesian.padding(10d, 20d, 5d, 20d);
|
||||
|
||||
cartesian.crosshair().enabled(true);
|
||||
cartesian.crosshair()
|
||||
.yLabel(true)
|
||||
// TODO ystroke
|
||||
.yStroke((Stroke) null, null, null, (String) null, (String) null);
|
||||
|
||||
cartesian.tooltip().positionMode(TooltipPositionMode.POINT);
|
||||
|
||||
cartesian.title("Trend of Sales of the Most Popular Products of ACME Corp.");
|
||||
|
||||
cartesian.yAxis(0).title("Number of Bottles Sold (thousands)");
|
||||
cartesian.xAxis(0).labels().padding(5d, 5d, 5d, 5d);
|
||||
|
||||
List<DataEntry> seriesData = new ArrayList<>();
|
||||
seriesData.add(new CustomDataEntry("1986", 3.6, 2.3, 2.8));
|
||||
seriesData.add(new CustomDataEntry("1987", 7.1, 4.0, 4.1));
|
||||
seriesData.add(new CustomDataEntry("1988", 8.5, 6.2, 5.1));
|
||||
seriesData.add(new CustomDataEntry("1989", 9.2, 11.8, 6.5));
|
||||
seriesData.add(new CustomDataEntry("1990", 10.1, 13.0, 12.5));
|
||||
seriesData.add(new CustomDataEntry("1991", 11.6, 13.9, 18.0));
|
||||
seriesData.add(new CustomDataEntry("1992", 16.4, 18.0, 21.0));
|
||||
seriesData.add(new CustomDataEntry("1993", 18.0, 23.3, 20.3));
|
||||
seriesData.add(new CustomDataEntry("1994", 13.2, 24.7, 19.2));
|
||||
seriesData.add(new CustomDataEntry("1995", 12.0, 18.0, 14.4));
|
||||
seriesData.add(new CustomDataEntry("1996", 3.2, 15.1, 9.2));
|
||||
seriesData.add(new CustomDataEntry("1997", 4.1, 11.3, 5.9));
|
||||
seriesData.add(new CustomDataEntry("1998", 6.3, 14.2, 5.2));
|
||||
seriesData.add(new CustomDataEntry("1999", 9.4, 13.7, 4.7));
|
||||
seriesData.add(new CustomDataEntry("2000", 11.5, 9.9, 4.2));
|
||||
seriesData.add(new CustomDataEntry("2001", 13.5, 12.1, 1.2));
|
||||
seriesData.add(new CustomDataEntry("2002", 14.8, 13.5, 5.4));
|
||||
seriesData.add(new CustomDataEntry("2003", 16.6, 15.1, 6.3));
|
||||
seriesData.add(new CustomDataEntry("2004", 18.1, 17.9, 8.9));
|
||||
seriesData.add(new CustomDataEntry("2005", 17.0, 18.9, 10.1));
|
||||
seriesData.add(new CustomDataEntry("2006", 16.6, 20.3, 11.5));
|
||||
seriesData.add(new CustomDataEntry("2007", 14.1, 20.7, 12.2));
|
||||
seriesData.add(new CustomDataEntry("2008", 15.7, 21.6, 10));
|
||||
seriesData.add(new CustomDataEntry("2009", 12.0, 22.5, 8.9));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(seriesData);
|
||||
Mapping series1Mapping = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping series2Mapping = set.mapAs("{ x: 'x', value: 'value2' }");
|
||||
Mapping series3Mapping = set.mapAs("{ x: 'x', value: 'value3' }");
|
||||
|
||||
Line series1 = cartesian.line(series1Mapping);
|
||||
series1.name("Brandy");
|
||||
series1.hovered().markers().enabled(true);
|
||||
series1.hovered().markers()
|
||||
.type(MarkerType.CIRCLE)
|
||||
.size(4d);
|
||||
series1.tooltip()
|
||||
.position("right")
|
||||
.anchor(Anchor.LEFT_CENTER)
|
||||
.offsetX(5d)
|
||||
.offsetY(5d);
|
||||
|
||||
Line series2 = cartesian.line(series2Mapping);
|
||||
series2.name("Whiskey");
|
||||
series2.hovered().markers().enabled(true);
|
||||
series2.hovered().markers()
|
||||
.type(MarkerType.CIRCLE)
|
||||
.size(4d);
|
||||
series2.tooltip()
|
||||
.position("right")
|
||||
.anchor(Anchor.LEFT_CENTER)
|
||||
.offsetX(5d)
|
||||
.offsetY(5d);
|
||||
|
||||
Line series3 = cartesian.line(series3Mapping);
|
||||
series3.name("Tequila");
|
||||
series3.hovered().markers().enabled(true);
|
||||
series3.hovered().markers()
|
||||
.type(MarkerType.CIRCLE)
|
||||
.size(4d);
|
||||
series3.tooltip()
|
||||
.position("right")
|
||||
.anchor(Anchor.LEFT_CENTER)
|
||||
.offsetX(5d)
|
||||
.offsetY(5d);
|
||||
|
||||
cartesian.legend().enabled(true);
|
||||
cartesian.legend().fontSize(13d);
|
||||
cartesian.legend().padding(0d, 0d, 10d, 0d);
|
||||
|
||||
anyChartView.setChart(cartesian);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
|
||||
CustomDataEntry(String x, Number value, Number value2, Number value3) {
|
||||
super(x, value);
|
||||
setValue("value2", value2);
|
||||
setValue("value3", value3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.SingleValueDataSet;
|
||||
import com.anychart.charts.LinearGauge;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.enums.Layout;
|
||||
import com.anychart.enums.MarkerType;
|
||||
import com.anychart.enums.Orientation;
|
||||
import com.anychart.enums.Position;
|
||||
import com.anychart.sample.R;
|
||||
import com.anychart.scales.OrdinalColor;
|
||||
|
||||
public class LinearColorScaleActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
LinearGauge linearGauge = AnyChart.linear();
|
||||
|
||||
linearGauge.data(new SingleValueDataSet(new Double[] { 5.3D }));
|
||||
|
||||
linearGauge.layout(Layout.HORIZONTAL);
|
||||
|
||||
linearGauge.label(0)
|
||||
.position(Position.LEFT_CENTER)
|
||||
.anchor(Anchor.LEFT_CENTER)
|
||||
.offsetY("-50px")
|
||||
.offsetX("50px")
|
||||
.fontColor("black")
|
||||
.fontSize(17);
|
||||
linearGauge.label(0).text("Total Rainfall");
|
||||
|
||||
linearGauge.label(1)
|
||||
.position(Position.LEFT_CENTER)
|
||||
.anchor(Anchor.LEFT_CENTER)
|
||||
.offsetY("40px")
|
||||
.offsetX("50px")
|
||||
.fontColor("#777777")
|
||||
.fontSize(17);
|
||||
linearGauge.label(1).text("Drought Hazard");
|
||||
|
||||
linearGauge.label(2)
|
||||
.position(Position.RIGHT_CENTER)
|
||||
.anchor(Anchor.RIGHT_CENTER)
|
||||
.offsetY("40px")
|
||||
.offsetX("50px")
|
||||
.fontColor("#777777")
|
||||
.fontSize(17);
|
||||
linearGauge.label(2).text("Flood Hazard");
|
||||
|
||||
OrdinalColor scaleBarColorScale = OrdinalColor.instantiate();
|
||||
scaleBarColorScale.ranges(new String[]{
|
||||
"{ from: 0, to: 2, color: ['red 0.5'] }",
|
||||
"{ from: 2, to: 3, color: ['yellow 0.5'] }",
|
||||
"{ from: 3, to: 7, color: ['green 0.5'] }",
|
||||
"{ from: 7, to: 8, color: ['yellow 0.5'] }",
|
||||
"{ from: 8, to: 10, color: ['red 0.5'] }"
|
||||
});
|
||||
|
||||
linearGauge.scaleBar(0)
|
||||
.width("5%")
|
||||
.colorScale(scaleBarColorScale);
|
||||
|
||||
linearGauge.marker(0)
|
||||
.type(MarkerType.TRIANGLE_DOWN)
|
||||
.color("red")
|
||||
.offset("-3.5%")
|
||||
.zIndex(10);
|
||||
|
||||
linearGauge.scale()
|
||||
.minimum(0)
|
||||
.maximum(10);
|
||||
// linearGauge.scale().ticks
|
||||
|
||||
linearGauge.axis(0)
|
||||
.minorTicks(false)
|
||||
.width("1%");
|
||||
linearGauge.axis(0)
|
||||
.offset("-1.5%")
|
||||
.orientation(Orientation.TOP)
|
||||
.labels("top");
|
||||
|
||||
linearGauge.padding(0, 30, 0, 30);
|
||||
|
||||
anyChartView.setChart(linearGauge);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Mekko;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.Orientation;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MekkoChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Mekko mekkoChart = AnyChart.mekko();
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomDataEntry("Acer", 2254, 1274, 635, 253));
|
||||
data.add(new CustomDataEntry("Dell", 1010, 950, 675, 250));
|
||||
data.add(new CustomDataEntry("HP", 417, 631, 405, 251));
|
||||
data.add(new CustomDataEntry("Lenovo", 210, 307, 450, 257));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(data);
|
||||
Mapping series1Data = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping series2Data = set.mapAs("{ x: 'x', value: 'value2' }");
|
||||
Mapping series3Data = set.mapAs("{ x: 'x', value: 'value3' }");
|
||||
Mapping series4Data = set.mapAs("{ x: 'x', value: 'value4' }");
|
||||
|
||||
mekkoChart.mekko(series1Data)
|
||||
.name("Phone");
|
||||
|
||||
mekkoChart.mekko(series2Data)
|
||||
.name("Tablet");
|
||||
|
||||
mekkoChart.mekko(series3Data)
|
||||
.name("Desktop");
|
||||
|
||||
mekkoChart.mekko(series4Data)
|
||||
.name("Laptop");
|
||||
|
||||
mekkoChart.xAxis(0).orientation(Orientation.TOP);
|
||||
|
||||
mekkoChart.labels().format("${%Value}k");
|
||||
|
||||
mekkoChart.tooltip().format("{%seriesName}: ${%Value}k");
|
||||
|
||||
anyChartView.setChart(mekkoChart);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
CustomDataEntry(String x, Number value, Number value2, Number value3, Number value4) {
|
||||
super(x, value);
|
||||
setValue("value2", value2);
|
||||
setValue("value3", value3);
|
||||
setValue("value4", value4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Mekko;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.Orientation;
|
||||
import com.anychart.enums.TooltipDisplayMode;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MosaicChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Mekko mosaic = AnyChart.mosaic();
|
||||
|
||||
mosaic.title("Skills and Self-ID Top Factors");
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomDataEntry("Data Businessperson", 50, 15, 10, 5, 25));
|
||||
data.add(new CustomDataEntry("Data Creative", 17, 23, 10, 20, 30));
|
||||
data.add(new CustomDataEntry("Data Developer", 17, 25, 16, 27, 15));
|
||||
data.add(new CustomDataEntry("Data Researcher", 12, 12, 17, 5, 51));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(data);
|
||||
Mapping series1Data = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping series2Data = set.mapAs("{ x: 'x', value: 'value2' }");
|
||||
Mapping series3Data = set.mapAs("{ x: 'x', value: 'value3' }");
|
||||
Mapping series4Data = set.mapAs("{ x: 'x', value: 'value4' }");
|
||||
Mapping series5Data = set.mapAs("{ x: 'x', value: 'value5' }");
|
||||
|
||||
mosaic.mekko(series1Data)
|
||||
.name("Business");
|
||||
|
||||
mosaic.mekko(series2Data)
|
||||
.name("ML/Big Data");
|
||||
|
||||
mosaic.mekko(series3Data)
|
||||
.name("Math/OR");
|
||||
|
||||
mosaic.mekko(series4Data)
|
||||
.name("Programming");
|
||||
|
||||
mosaic.mekko(series5Data)
|
||||
.name("Statistics");
|
||||
|
||||
mosaic.xAxis(0).orientation(Orientation.TOP);
|
||||
mosaic.tooltip().displayMode(TooltipDisplayMode.UNION);
|
||||
|
||||
anyChartView.setChart(mosaic);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
CustomDataEntry(String x, Number value, Number value2, Number value3, Number value4, Number value5) {
|
||||
super(x, value);
|
||||
setValue("value2", value2);
|
||||
setValue("value3", value3);
|
||||
setValue("value4", value4);
|
||||
setValue("value5", value5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.HighLowDataEntry;
|
||||
import com.anychart.charts.Stock;
|
||||
import com.anychart.core.stock.Plot;
|
||||
import com.anychart.data.Table;
|
||||
import com.anychart.data.TableMapping;
|
||||
import com.anychart.enums.StockSeriesType;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OHLCChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Table table = Table.instantiate("x");
|
||||
table.addData(getData());
|
||||
|
||||
TableMapping mapping = table.mapAs("{open: 'open', high: 'high', low: 'low', close: 'close'}");
|
||||
|
||||
Stock stock = AnyChart.stock();
|
||||
|
||||
Plot plot = stock.plot(0);
|
||||
plot.yGrid(true)
|
||||
.xGrid(true)
|
||||
.yMinorGrid(true)
|
||||
.xMinorGrid(true);
|
||||
|
||||
plot.ema(table.mapAs("{value: 'close'}"), 20d, StockSeriesType.LINE);
|
||||
|
||||
plot.ohlc(mapping)
|
||||
.name("CSCO")
|
||||
.legendItem("{\n" +
|
||||
" iconType: 'rising-falling'\n" +
|
||||
" }");
|
||||
|
||||
stock.scroller().ohlc(mapping);
|
||||
|
||||
anyChartView.setChart(stock);
|
||||
}
|
||||
|
||||
private List<DataEntry> getData() {
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new OHCLDataEntry(638380800000L,0.0825,0.0842,0.0816,0.0842));
|
||||
data.add(new OHCLDataEntry(638467200000L,0.0833,0.0859,0.0825,0.0859));
|
||||
data.add(new OHCLDataEntry(638553600000L,0.0859,0.0859,0.0851,0.0851));
|
||||
data.add(new OHCLDataEntry(638640000000L,0.0851,0.0851,0.0833,0.0851));
|
||||
data.add(new OHCLDataEntry(638726400000L,0.0833,0.0833,0.0799,0.0816));
|
||||
data.add(new OHCLDataEntry(638985600000L,0.079,0.0807,0.0773,0.0799));
|
||||
data.add(new OHCLDataEntry(639072000000L,0.079,0.0816,0.079,0.0807));
|
||||
data.add(new OHCLDataEntry(639158400000L,0.0807,0.0816,0.0807,0.0807));
|
||||
data.add(new OHCLDataEntry(639244800000L,0.0816,0.0816,0.0799,0.0803));
|
||||
data.add(new OHCLDataEntry(639331200000L,0.0799,0.0807,0.079,0.079));
|
||||
data.add(new OHCLDataEntry(639590400000L,0.0799,0.0799,0.0781,0.0781));
|
||||
data.add(new OHCLDataEntry(639676800000L,0.0781,0.0799,0.0746,0.0764));
|
||||
data.add(new OHCLDataEntry(639763200000L,0.0764,0.0773,0.0755,0.0764));
|
||||
data.add(new OHCLDataEntry(639849600000L,0.0773,0.0773,0.0755,0.0773));
|
||||
data.add(new OHCLDataEntry(640195200000L,0.0773,0.0781,0.0764,0.0773));
|
||||
data.add(new OHCLDataEntry(640281600000L,0.0764,0.0781,0.0755,0.0781));
|
||||
data.add(new OHCLDataEntry(640368000000L,0.0781,0.0799,0.0773,0.079));
|
||||
data.add(new OHCLDataEntry(640454400000L,0.0781,0.0799,0.0781,0.0799));
|
||||
data.add(new OHCLDataEntry(640540800000L,0.0799,0.0799,0.0773,0.0773));
|
||||
data.add(new OHCLDataEntry(640800000000L,0.0773,0.079,0.0764,0.0781));
|
||||
data.add(new OHCLDataEntry(640886400000L,0.0799,0.0799,0.079,0.0794));
|
||||
data.add(new OHCLDataEntry(640972800000L,0.0799,0.0807,0.0799,0.0799));
|
||||
data.add(new OHCLDataEntry(641059200000L,0.0799,0.0816,0.0799,0.0799));
|
||||
data.add(new OHCLDataEntry(641145600000L,0.0799,0.0807,0.079,0.079));
|
||||
data.add(new OHCLDataEntry(641404800000L,0.0807,0.0842,0.0799,0.0825));
|
||||
data.add(new OHCLDataEntry(641491200000L,0.0842,0.0842,0.0825,0.0838));
|
||||
data.add(new OHCLDataEntry(641577600000L,0.0833,0.0842,0.0825,0.0825));
|
||||
data.add(new OHCLDataEntry(641664000000L,0.0842,0.0851,0.0833,0.0851));
|
||||
data.add(new OHCLDataEntry(641750400000L,0.0842,0.0859,0.0842,0.0859));
|
||||
data.add(new OHCLDataEntry(642009600000L,0.0859,0.0885,0.0859,0.0868));
|
||||
data.add(new OHCLDataEntry(642096000000L,0.0885,0.0885,0.0859,0.0877));
|
||||
data.add(new OHCLDataEntry(642182400000L,0.0877,0.0877,0.0851,0.0859));
|
||||
data.add(new OHCLDataEntry(642268800000L,0.0868,0.0868,0.0851,0.0851));
|
||||
data.add(new OHCLDataEntry(642355200000L,0.0885,0.0894,0.0851,0.0859));
|
||||
data.add(new OHCLDataEntry(642614400000L,0.0877,0.0877,0.0859,0.0859));
|
||||
data.add(new OHCLDataEntry(642700800000L,0.0877,0.0877,0.0859,0.0864));
|
||||
data.add(new OHCLDataEntry(642787200000L,0.0877,0.0877,0.0851,0.0859));
|
||||
data.add(new OHCLDataEntry(642873600000L,0.0868,0.0868,0.0859,0.0868));
|
||||
data.add(new OHCLDataEntry(642960000000L,0.0859,0.0868,0.0842,0.0851));
|
||||
data.add(new OHCLDataEntry(643219200000L,0.0842,0.0868,0.0842,0.0851));
|
||||
data.add(new OHCLDataEntry(643305600000L,0.0851,0.0859,0.0851,0.0851));
|
||||
data.add(new OHCLDataEntry(643392000000L,0.0851,0.0859,0.0842,0.0842));
|
||||
data.add(new OHCLDataEntry(643478400000L,0.0859,0.0859,0.0842,0.0859));
|
||||
data.add(new OHCLDataEntry(643564800000L,0.0833,0.0851,0.0825,0.0833));
|
||||
data.add(new OHCLDataEntry(643910400000L,0.0833,0.0851,0.0816,0.0825));
|
||||
data.add(new OHCLDataEntry(643996800000L,0.0833,0.0833,0.0807,0.0816));
|
||||
data.add(new OHCLDataEntry(644083200000L,0.0807,0.0868,0.0807,0.0859));
|
||||
data.add(new OHCLDataEntry(644169600000L,0.0859,0.0885,0.0851,0.0868));
|
||||
data.add(new OHCLDataEntry(644428800000L,0.0877,0.0894,0.0859,0.0894));
|
||||
data.add(new OHCLDataEntry(644515200000L,0.0885,0.0938,0.0885,0.0929));
|
||||
data.add(new OHCLDataEntry(644601600000L,0.0929,0.0929,0.0903,0.092));
|
||||
data.add(new OHCLDataEntry(644688000000L,0.0929,0.0929,0.0885,0.0894));
|
||||
data.add(new OHCLDataEntry(644774400000L,0.0903,0.0903,0.0868,0.0877));
|
||||
data.add(new OHCLDataEntry(645033600000L,0.0851,0.0877,0.0851,0.0872));
|
||||
data.add(new OHCLDataEntry(645120000000L,0.0877,0.0972,0.0868,0.0955));
|
||||
data.add(new OHCLDataEntry(645206400000L,0.0972,0.0972,0.0963,0.0963));
|
||||
data.add(new OHCLDataEntry(645292800000L,0.0972,0.0981,0.0955,0.0972));
|
||||
data.add(new OHCLDataEntry(645379200000L,0.0955,0.0972,0.0955,0.0955));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private class OHCLDataEntry extends HighLowDataEntry {
|
||||
OHCLDataEntry(Long x, Double open, Double high, Double low, Double close) {
|
||||
super(x, high, low);
|
||||
setValue("open", open);
|
||||
setValue("close", close);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Pareto;
|
||||
import com.anychart.core.cartesian.series.Base;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.graphics.vector.StrokeLineCap;
|
||||
import com.anychart.graphics.vector.StrokeLineJoin;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ParetoChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Pareto pareto = AnyChart.pareto();
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
|
||||
data.add(new ValueDataEntry("Food is tasteless", 65));
|
||||
data.add(new ValueDataEntry("Wait time", 109));
|
||||
data.add(new ValueDataEntry("Unfriendly staff", 12.5));
|
||||
data.add(new ValueDataEntry("Not clean", 45));
|
||||
data.add(new ValueDataEntry("Overpriced", 250));
|
||||
data.add(new ValueDataEntry("To noisy", 27));
|
||||
data.add(new ValueDataEntry("Food not fresh", 35));
|
||||
data.add(new ValueDataEntry("Small portions", 170));
|
||||
data.add(new ValueDataEntry("Not atmosphere", 35));
|
||||
data.add(new ValueDataEntry("Food is to salty", 35));
|
||||
|
||||
pareto.data(data);
|
||||
|
||||
pareto.title("Pareto Chart of Restaurant Complaints");
|
||||
|
||||
pareto.yAxis(0d).title("Defect frequency");
|
||||
|
||||
pareto.yAxis(1d).title("Cumulative Percentage");
|
||||
|
||||
pareto.animation(true);
|
||||
|
||||
pareto.lineMarker(0)
|
||||
.value(80d)
|
||||
.axis(pareto.yAxis(1d))
|
||||
.stroke("#A5B3B3", 1d, "5 2", StrokeLineJoin.ROUND, StrokeLineCap.ROUND);
|
||||
|
||||
pareto.getSeries(0d).tooltip().format("Value: {%Value}");
|
||||
|
||||
Base line = pareto.getSeries(1d);
|
||||
line.seriesType("spline")
|
||||
.markers(true);
|
||||
line.labels().enabled(true);
|
||||
line.labels()
|
||||
.anchor(Anchor.RIGHT_BOTTOM)
|
||||
.format("{%CF}%");
|
||||
line.tooltip().format("Cumulative Frequency: {%CF}% \\n Relative Frequency: {%RF}%");
|
||||
|
||||
pareto.crosshair().enabled(true);
|
||||
pareto.crosshair().xLabel(true);
|
||||
|
||||
anyChartView.setChart(pareto);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.PertDataEntry;
|
||||
import com.anychart.charts.Pert;
|
||||
import com.anychart.core.pert.Milestones;
|
||||
import com.anychart.core.pert.Tasks;
|
||||
import com.anychart.core.ui.Tooltip;
|
||||
import com.anychart.enums.TreeFillingMethod;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PertChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Pert pert = AnyChart.pert();
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomPertDataEntry("1", 30, "1", "Aerodinamics"));
|
||||
data.add(new CustomPertDataEntry("2", 50, "2", "Build & Test Model"));
|
||||
data.add(new CustomPertDataEntry("3", 35, "3", "Structure"));
|
||||
data.add(new CustomPertDataEntry("4", 50, "4", new String[]{"1"}, "Propulsion"));
|
||||
data.add(new CustomPertDataEntry("5", 60, "5", new String[]{"2"}, "Build Prototype"));
|
||||
data.add(new CustomPertDataEntry("6", 40, "6", new String[]{"3"}, "Control & Stability"));
|
||||
data.add(new CustomPertDataEntry("7", 20, "7", new String[]{"4"}, "Wind Tunnel"));
|
||||
data.add(new CustomPertDataEntry("8", 20, "8", new String[]{"6"}, "Computation"));
|
||||
data.add(new CustomPertDataEntry("9", 45, "9", new String[]{"7"}, "Review"));
|
||||
data.add(new CustomPertDataEntry("10", 30, "10", new String[]{"8"}, "Flight Simulation"));
|
||||
data.add(new CustomPertDataEntry("11", 50, "11", new String[]{"9"}, "Research flights"));
|
||||
data.add(new CustomPertDataEntry("12", 45, "12", new String[]{"10"}, "Revise & Review"));
|
||||
data.add(new CustomPertDataEntry("13", 25, "13", new String[]{"5"}, "Finalize"));
|
||||
|
||||
pert.data(data, TreeFillingMethod.AS_TABLE);
|
||||
|
||||
pert.padding(50d, 0d, 0d, 50d);
|
||||
|
||||
pert.title().enabled(true);
|
||||
pert.title().useHtml(true);
|
||||
pert.title()
|
||||
.padding(new Double[]{ 0d, 50d, 35d, 0d })
|
||||
.text("Airplane Design Process with PERT Chart");
|
||||
|
||||
Tasks tasks = pert.tasks();
|
||||
tasks.upperLabels().format(
|
||||
"function() {\n" +
|
||||
" return this.item.get('fullName');\n" +
|
||||
" }");
|
||||
|
||||
tasks.lowerLabels().format("{%duration} days");
|
||||
|
||||
Tooltip tooltip = tasks.tooltip();
|
||||
tooltip.separator(true)
|
||||
.titleFormat(
|
||||
"function() {\n" +
|
||||
" return this.item.get('fullName');\n" +
|
||||
" }");
|
||||
tooltip.title().useHtml(true);
|
||||
|
||||
Milestones milestones = pert.milestones();
|
||||
milestones.color("#2C81D5")
|
||||
.size("6.5%");
|
||||
milestones.hovered().fill("#2C81D5", 0.75d);
|
||||
milestones.tooltip().format("" +
|
||||
"function() {\n" +
|
||||
" var result = '';\n" +
|
||||
" var i = 0;\n" +
|
||||
" if (this['successors'] && this['successors'].length) {\n" +
|
||||
" result += 'Successors:';\n" +
|
||||
" for (i = 0; i < this['successors'].length; i++) {\n" +
|
||||
" result += '\\n - ' + this['successors'][i].get('fullName');\n" +
|
||||
" }\n" +
|
||||
" if (this['predecessors'] && this['predecessors'].length)\n" +
|
||||
" result += '\\n\\n';\n" +
|
||||
" }\n" +
|
||||
" if (this['predecessors'] && this['predecessors'].length) {\n" +
|
||||
" result += 'Predecessors:';\n" +
|
||||
" for (i = 0; i < this['predecessors'].length; i++) {\n" +
|
||||
" result += '\\n - ' + this['predecessors'][i].get('fullName');\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" return result;\n" +
|
||||
"}");
|
||||
|
||||
Milestones critMilestones = pert.criticalPath().milestones();
|
||||
critMilestones.labels().format(
|
||||
"function() {\n" +
|
||||
" return this['creator'] ? this['creator'].get('name') : this['isStart'] ? 'Start' : 'Finish';\n" +
|
||||
" }");
|
||||
critMilestones.color("#E24B26");
|
||||
|
||||
|
||||
|
||||
anyChartView.setChart(pert);
|
||||
}
|
||||
|
||||
private class CustomPertDataEntry extends PertDataEntry {
|
||||
CustomPertDataEntry(String id, int duration, String name, String fullName) {
|
||||
super(id, name, fullName);
|
||||
setValue("duration", duration);
|
||||
}
|
||||
|
||||
CustomPertDataEntry(String id, int duration, String name, String[] dependsOn, String fullName) {
|
||||
super(id, name, fullName, dependsOn);
|
||||
setValue("duration", duration);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.chart.common.listener.Event;
|
||||
import com.anychart.chart.common.listener.ListenersInterface;
|
||||
import com.anychart.charts.Pie;
|
||||
import com.anychart.enums.Align;
|
||||
import com.anychart.enums.LegendLayout;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PieChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Pie pie = AnyChart.pie();
|
||||
|
||||
pie.setOnClickListener(new ListenersInterface.OnClickListener(new String[]{"x", "value"}) {
|
||||
@Override
|
||||
public void onClick(Event event) {
|
||||
Toast.makeText(PieChartActivity.this, event.getData().get("x") + ":" + event.getData().get("value"), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new ValueDataEntry("Apples", 6371664));
|
||||
data.add(new ValueDataEntry("Pears", 789622));
|
||||
data.add(new ValueDataEntry("Bananas", 7216301));
|
||||
data.add(new ValueDataEntry("Grapes", 1486621));
|
||||
data.add(new ValueDataEntry("Oranges", 1200000));
|
||||
|
||||
pie.data(data);
|
||||
|
||||
pie.title("Fruits imported in 2015 (in kg)");
|
||||
|
||||
pie.labels().position("outside");
|
||||
|
||||
pie.legend().title().enabled(true);
|
||||
pie.legend().title()
|
||||
.text("Retail channels")
|
||||
.padding(0d, 0d, 10d, 0d);
|
||||
|
||||
pie.legend()
|
||||
.position("center-bottom")
|
||||
.itemsLayout(LegendLayout.HORIZONTAL)
|
||||
.align(Align.CENTER);
|
||||
|
||||
anyChartView.setChart(pie);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.charts.Map;
|
||||
import com.anychart.core.map.series.Marker;
|
||||
import com.anychart.enums.SelectionMode;
|
||||
import com.anychart.graphics.vector.SolidFill;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PointMapActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Map map = AnyChart.map();
|
||||
|
||||
map.credits().enabled(true);
|
||||
map.credits()
|
||||
.url("https://opendata.socrata.com/dataset/Airport-Codes-mapped-to-Latitude-Longitude-in-the-/rxrh-4cxm")
|
||||
.text("Data source: https://opendata.socrata.com")
|
||||
.logoSrc("https://opendata.socrata.com/stylesheets/images/common/favicon.ico");
|
||||
|
||||
map.unboundRegions()
|
||||
.enabled(true)
|
||||
.fill(new SolidFill("#E1E1E1", 1))
|
||||
.stroke("#D2D2D2");
|
||||
|
||||
map.geoData("anychart.maps.united_states_of_america");
|
||||
|
||||
map.title()
|
||||
.enabled(true)
|
||||
.useHtml(true)
|
||||
.padding(0, 0, 10, 0)
|
||||
.text("Airports in the United States<br/><span style=\"color:#929292; font-size: 12px;\">" +
|
||||
"According to opendata.socrata.com<br/>Cities and names were collected from Wikipedia.org</span>");
|
||||
|
||||
Marker series = map.marker(getData());
|
||||
series.tooltip()
|
||||
.useHtml(true)
|
||||
.padding(8, 13, 10, 13)
|
||||
.title(false)
|
||||
.separator(false)
|
||||
.fontSize(14)
|
||||
.format("function() {\n" +
|
||||
" return '<span>' + this.getData('name') + '</span><br/>' +\n" +
|
||||
" '<span style=\"font-size: 12px; color: #E1E1E1\">City: ' +\n" +
|
||||
" this.getData('city') + '</span>';\n" +
|
||||
" }");
|
||||
|
||||
series.size(5)
|
||||
.labels(false);
|
||||
series.stroke("2 #E1E1E1")
|
||||
.fill("#1976d2", 1);
|
||||
series.selectionMode(SelectionMode.NONE);
|
||||
|
||||
anyChartView.addScript("file:///android_asset/united_states_of_america.js");
|
||||
anyChartView.addScript("file:///android_asset/proj4.js");
|
||||
anyChartView.setChart(map);
|
||||
}
|
||||
|
||||
private List<DataEntry> getData() {
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
|
||||
data.add(new CustomDataEntry("BHM", "Birmingham", "Birmingham-Shuttlesworth International Airport", 33.5639, -86.7522));
|
||||
data.add(new CustomDataEntry("DHN", "Dothan", "Dothan Regional Airport", 31.3214, -85.4497));
|
||||
data.add(new CustomDataEntry("HSV", "Huntsville", "Huntsville International Airport", 34.6372, -86.775));
|
||||
data.add(new CustomDataEntry("MOB", "Mobile", "Mobile Regional Airport", 30.6914, -88.2428));
|
||||
data.add(new CustomDataEntry("MGM", "Montgomery", "Montgomery Regional Airport", 32.3006, -86.3939));
|
||||
data.add(new CustomDataEntry("IFP", "Bullhead City", "Laughlin/Bullhead International Airport", 35.1561, -114.5594));
|
||||
data.add(new CustomDataEntry("FLG", "Flagstaff", "Flagstaff Pulliam Airport", 35.1403, -111.6692));
|
||||
data.add(new CustomDataEntry("GCN", "Grand Canyon / Tusayan", "Grand Canyon National Park Airport", 35.9522, -112.1469));
|
||||
data.add(new CustomDataEntry("IWA", "Mesa", "Phoenix-Mesa Gateway Airport", 33.3078, -111.6556));
|
||||
data.add(new CustomDataEntry("PGA", "Page", "Page Municipal Airport", 36.9261, -111.4483));
|
||||
data.add(new CustomDataEntry("1G4", "Peach Springs", "Grand Canyon West Airport", 35.9903, -113.8164));
|
||||
data.add(new CustomDataEntry("PHX", "Phoenix", "Phoenix Sky Harbor International Airport", 33.4342, -112.0117));
|
||||
data.add(new CustomDataEntry("TUS", "Tucson", "Tucson International Airport", 32.1161, -110.9411));
|
||||
data.add(new CustomDataEntry("NYL", "Yuma", "Yuma International Airport / MCAS Yuma", 32.6567, -114.6061));
|
||||
data.add(new CustomDataEntry("XNA", "Fayetteville", "Northwest Arkansas Regional Airport", 36.2819, -94.3069));
|
||||
data.add(new CustomDataEntry("FSM", "Fort Smith", "Fort Smith Regional Airport", 35.3367, -94.3675));
|
||||
data.add(new CustomDataEntry("LIT", "Little Rock", "Bill and Hillary Clinton National Airport", 34.7294, -92.2244));
|
||||
data.add(new CustomDataEntry("TXK", "Texarkana", "Texarkana Regional Airport", 33.4536, -93.9911));
|
||||
data.add(new CustomDataEntry("ACV", "Arcata / Eureka", "Arcata Airport", 40.9781, -124.1086));
|
||||
data.add(new CustomDataEntry("BFL", "Bakersfield", "Meadows Field", 35.4339, -119.0578));
|
||||
data.add(new CustomDataEntry("BUR", "Burbank", "Bob Hope Airport", 34.2006, -118.3586));
|
||||
data.add(new CustomDataEntry("CRQ", "Carlsbad", "McClellan-Palomar Airport", 33.1283, -117.28));
|
||||
data.add(new CustomDataEntry("CIC", "Chico", "Chico Municipal Airport", 39.7953, -121.8583));
|
||||
data.add(new CustomDataEntry("CEC", "Crescent City", "Del Norte County Airport", 41.7803, -124.2367));
|
||||
data.add(new CustomDataEntry("FAT", "Fresno", "Fresno Yosemite International Airport", 36.7761, -119.7181));
|
||||
data.add(new CustomDataEntry("LGB", "Long Beach", "Long Beach Airport<br/>(Daugherty Field)", 33.8178, -118.1517));
|
||||
data.add(new CustomDataEntry("LAX", "Los Angeles", "Los Angeles International Airport", 33.9425, -118.4072));
|
||||
data.add(new CustomDataEntry("MMH", "Mammoth Lakes", "Mammoth Yosemite Airport", 37.6242, -118.8378));
|
||||
data.add(new CustomDataEntry("MOD", "Modesto", "Modesto City-County Airport<br/>(Harry Sham Field)", 37.6258, -120.9544));
|
||||
data.add(new CustomDataEntry("MRY", "Monterey", "Monterey Regional Airport<br/>(was Monterey Peninsula Airport)", 36.5869, -121.8431));
|
||||
data.add(new CustomDataEntry("OAK", "Oakland", "Oakland International Airport", 37.7214, -122.2208));
|
||||
data.add(new CustomDataEntry("ONT", "Ontario", "Ontario International Airport", 34.0561, -117.6011));
|
||||
data.add(new CustomDataEntry("PSP", "Palm Springs", "Palm Springs International Airport", 33.8297, -116.5067));
|
||||
data.add(new CustomDataEntry("RDD", "Redding", "Redding Municipal Airport", 40.5089, -122.2933));
|
||||
data.add(new CustomDataEntry("SMF", "Sacramento", "Sacramento International Airport", 38.6956, -121.5908));
|
||||
data.add(new CustomDataEntry("SAN", "San Diego", "San Diego International Airport", 32.7336, -117.1897));
|
||||
data.add(new CustomDataEntry("SFO", "San Francisco", "San Francisco International Airport", 37.6189, -122.375));
|
||||
data.add(new CustomDataEntry("SJC", "San Jose", "Norman Y. Mineta San José International Airport", 37.3628, -121.9292));
|
||||
data.add(new CustomDataEntry("SBP", "San Luis Obispo", "San Luis Obispo County Regional Airport<br/>(McChesney Field)", 35.2372, -120.6425));
|
||||
data.add(new CustomDataEntry("SNA", "Santa Ana", "John Wayne Airport - Orange County<br/>(was Orange County Airport)", 33.6756, -117.8683));
|
||||
data.add(new CustomDataEntry("SBA", "Santa Barbara", "Santa Barbara Municipal Airport<br/>(Santa Barbara Airport)", 34.4261, -119.8414));
|
||||
data.add(new CustomDataEntry("SMX", "Santa Maria", "Santa Maria Public Airport<br/>(Capt G. Allan Hancock Field)", 34.8989, -120.4575));
|
||||
data.add(new CustomDataEntry("STS", "Santa Rosa", "Charles M. Schulz-Sonoma County Airport", 38.5089, -122.8128));
|
||||
data.add(new CustomDataEntry("SCK", "Stockton", "Stockton Metropolitan Airport", 37.8942, -121.2383));
|
||||
data.add(new CustomDataEntry("ASE", "Aspen", "Aspen-Pitkin County Airport<br/>(Sardy Field)", 39.2231, -106.8689));
|
||||
data.add(new CustomDataEntry("COS", "Colorado Springs", "City of Colorado Springs Municipal Airport", 38.8058, -104.7008));
|
||||
data.add(new CustomDataEntry("DEN", "Denver", "Denver International Airport", 39.8617, -104.6731));
|
||||
data.add(new CustomDataEntry("DRO", "Durango", "Durango-La Plata County Airport", 37.1514, -107.7539));
|
||||
data.add(new CustomDataEntry("EGE", "Eagle", "Eagle County Regional Airport", 39.6414, -106.9175));
|
||||
data.add(new CustomDataEntry("GJT", "Grand Junction", "Grand Junction Regional Airport<br/>(Walker Field)", 39.1225, -108.5267));
|
||||
data.add(new CustomDataEntry("GUC", "Gunnison", "Gunnison-Crested Butte Regional Airport", 38.5339, -106.9331));
|
||||
data.add(new CustomDataEntry("HDN", "Hayden", "Yampa Valley Airport (Yampa Valley Regional)", 40.4811, -107.2178));
|
||||
data.add(new CustomDataEntry("MTJ", "Montrose", "Montrose Regional Airport", 38.5097, -107.8942));
|
||||
data.add(new CustomDataEntry("BDL", "Hartford", "Bradley International Airport", 41.9389, -72.6833));
|
||||
data.add(new CustomDataEntry("HVN", "New Haven", "Tweed New Haven Regional Airport", 41.2639, -72.8867));
|
||||
data.add(new CustomDataEntry("DAB", "Daytona Beach", "Daytona Beach International Airport", 29.18, -81.0581));
|
||||
data.add(new CustomDataEntry("FLL", "Fort Lauderdale", "Fort Lauderdale-Hollywood International Airport", 26.0726, -80.1528));
|
||||
data.add(new CustomDataEntry("RSW", "Fort Myers", "Southwest Florida International Airport", 26.5362, -81.7553));
|
||||
data.add(new CustomDataEntry("GNV", "Gainesville", "Gainesville Regional Airport", 29.69, -82.2717));
|
||||
data.add(new CustomDataEntry("JAX", "Jacksonville", "Jacksonville International Airport", 30.4942, -81.6878));
|
||||
data.add(new CustomDataEntry("MLB", "Melbourne", "Melbourne International Airport", 28.1028, -80.6453));
|
||||
data.add(new CustomDataEntry("MIA", "Miami", "Miami International Airport", 25.7932, -80.2906));
|
||||
data.add(new CustomDataEntry("MCO", "Orlando", "Orlando International Airport", 28.4294, -81.3089));
|
||||
data.add(new CustomDataEntry("SFB", "Orlando/Sanford", "Orlando Sanford International Airport", 28.7767, -81.2356));
|
||||
data.add(new CustomDataEntry("PNS", "Pensacola", "Pensacola International Airport<br/>(Pensacola Gulf Coast Regional Airport)", 30.4733, -87.1867));
|
||||
data.add(new CustomDataEntry("PGD", "Punta Gorda", "Punta Gorda Airport<br/>(was Charlotte County Airport)", 26.9198, -81.9906));
|
||||
data.add(new CustomDataEntry("SRQ", "Sarasota / Bradenton", "Sarasota-Bradenton International Airport", 27.3954, -82.5544));
|
||||
data.add(new CustomDataEntry("SGJ", "St. Augustine", "Northeast Florida Regional Airport<br/>(was St. Augustine Airport)", 29.9592, -81.3397));
|
||||
data.add(new CustomDataEntry("PIE", "St. Petersburg/Clearwater", "St. Petersburg International Airport", 27.91, -82.6875));
|
||||
data.add(new CustomDataEntry("TLH", "Tallahassee", "Tallahassee Regional Airport", 30.3967, -84.3503));
|
||||
data.add(new CustomDataEntry("TPA", "Tampa", "Tampa International Airport", 27.9756, -82.5333));
|
||||
data.add(new CustomDataEntry("VPS", "Valparaiso", "Destin-Fort Walton Beach Airport<br/>Eglin Air Force Base", 30.4833, -86.5253));
|
||||
data.add(new CustomDataEntry("PBI", "West Palm Beach", "Palm Beach International Airport", 26.6832, -80.0956));
|
||||
data.add(new CustomDataEntry("ABY", "Albany", "Southwest Georgia Regional Airport", 31.5356, -84.1944));
|
||||
data.add(new CustomDataEntry("ATL", "Atlanta", "Hartsfield-Jackson Atlanta International Airport", 33.6367, -84.4281));
|
||||
data.add(new CustomDataEntry("AGS", "Augusta", "Augusta Regional Airport", 33.37, -81.9644));
|
||||
data.add(new CustomDataEntry("BQK", "Brunswick", "Brunswick Golden Isles Airport", 31.2592, -81.4664));
|
||||
data.add(new CustomDataEntry("CSG", "Columbus", "Columbus Metropolitan Airport", 32.5164, -84.9389));
|
||||
data.add(new CustomDataEntry("SAV", "Savannah", "Savannah/Hilton Head International Airport", 32.1275, -81.2022));
|
||||
data.add(new CustomDataEntry("VLD", "Valdosta", "Valdosta Regional Airport", 30.7814, -83.2761));
|
||||
data.add(new CustomDataEntry("ITO", "Hilo", "Hilo International Airport", 19.7202, -155.0483));
|
||||
data.add(new CustomDataEntry("HNL", "Honolulu", "Honolulu International Airport", 21.3187, -157.9225));
|
||||
data.add(new CustomDataEntry("OGG", "Kahului", "Kahului Airport", 20.8986, -156.4306));
|
||||
data.add(new CustomDataEntry("KOA", "Kailua/Kona", "Kona International Airport at Keahole", 19.7388, -156.0456));
|
||||
data.add(new CustomDataEntry("MKK", "Kaunakakai", "Molokai Airport<br/>(Molokaʻi Airport)", 21.1529, -157.0961));
|
||||
data.add(new CustomDataEntry("LNY", "Lanai City (Lānaʻi City)", "Lanai Airport<br/>(Lānaʻi Airport)", 20.7856, -156.9514));
|
||||
data.add(new CustomDataEntry("LIH", "Lihue (Līhuʻe)", "Lihue Airport<br/>(Līhuʻe Airport)", 21.976, -159.3389));
|
||||
data.add(new CustomDataEntry("BOI", "Boise", "Boise Airport (Boise Air Terminal) (Gowen Field)", 43.5644, -116.2228));
|
||||
data.add(new CustomDataEntry("SUN", "Hailey", "Friedman Memorial Airport", 43.5039, -114.2956));
|
||||
data.add(new CustomDataEntry("IDA", "Idaho Falls", "Idaho Falls Regional Airport (Fanning Field)", 43.5136, -112.0708));
|
||||
data.add(new CustomDataEntry("LWS", "Lewiston", "Lewiston-Nez Perce County Airport", 46.3744, -117.0153));
|
||||
data.add(new CustomDataEntry("PIH", "Pocatello / Arbon Valley", "Pocatello Regional Airport", 42.9097, -112.5958));
|
||||
data.add(new CustomDataEntry("TWF", "Twin Falls", "Magic Valley Regional Airport<br/>(Joslin Field)", 42.4817, -114.4878));
|
||||
data.add(new CustomDataEntry("BLV", "Belleville", "MidAmerica St. Louis Airport<br/>Scott Air Force Base", 38.5453, -89.8353));
|
||||
data.add(new CustomDataEntry("BMI", "Bloomington / Normal", "Central Illinois Regional Airport at Bloomington-Normal", 40.4772, -88.9158));
|
||||
data.add(new CustomDataEntry("CMI", "Champaign / Urbana", "University of Illinois - Willard Airport", 40.0389, -88.2778));
|
||||
data.add(new CustomDataEntry("ORD", "Chicago", "Chicago O\\'Hare International Airport", 41.9808, -87.9067));
|
||||
data.add(new CustomDataEntry("MDW", "Chicago", "Chicago Midway International Airport", 41.7861, -87.7525));
|
||||
data.add(new CustomDataEntry("MWA", "Marion", "Williamson County Regional Airport", 37.755, -89.0111));
|
||||
data.add(new CustomDataEntry("MLI", "Moline", "Quad City International Airport", 41.4486, -90.5072));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
class CustomDataEntry extends DataEntry {
|
||||
public CustomDataEntry(String id, String city, String name, Double latitude, Double longitude) {
|
||||
setValue("id", id);
|
||||
setValue("city", city);
|
||||
setValue("name", name);
|
||||
setValue("lat", latitude);
|
||||
setValue("long", longitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Polar;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.PolarSeriesType;
|
||||
import com.anychart.enums.ScaleStackMode;
|
||||
import com.anychart.enums.ScaleTypes;
|
||||
import com.anychart.enums.TooltipDisplayMode;
|
||||
import com.anychart.sample.R;
|
||||
import com.anychart.scales.Linear;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PolarChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Polar polar = AnyChart.polar();
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomDataEntry("Nail polish", 12814, 4376, 4229));
|
||||
data.add(new CustomDataEntry("Eyebrow pencil", 13012, 3987, 3932));
|
||||
data.add(new CustomDataEntry("Rouge", 11624, 3574, 5221));
|
||||
data.add(new CustomDataEntry("Pomade", 8814, 4376, 9256));
|
||||
data.add(new CustomDataEntry("Eyeshadows", 12998, 4572, 3308));
|
||||
data.add(new CustomDataEntry("Eyeliner", 12321, 3417, 5432));
|
||||
data.add(new CustomDataEntry("Foundation", 10342, 5231, 13701));
|
||||
data.add(new CustomDataEntry("Lip gloss", 22998, 4572, 4008));
|
||||
data.add(new CustomDataEntry("Mascara", 11261, 6134, 18712));
|
||||
data.add(new CustomDataEntry("Powder", 10261, 5134, 25712));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(data);
|
||||
Mapping series1Data = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping series2Data = set.mapAs("{ x: 'x', value: 'value2' }");
|
||||
Mapping series3Data = set.mapAs("{ x: 'x', value: 'value3' }");
|
||||
|
||||
polar.column(series1Data);
|
||||
|
||||
polar.column(series2Data);
|
||||
|
||||
polar.column(series3Data);
|
||||
|
||||
polar.title("Company Profit Dynamic in Regions by Year");
|
||||
|
||||
polar.sortPointsByX(true)
|
||||
.defaultSeriesType(PolarSeriesType.COLUMN)
|
||||
.yAxis(false)
|
||||
.xScale(ScaleTypes.ORDINAL);
|
||||
|
||||
polar.title().margin().bottom(20d);
|
||||
|
||||
((Linear) polar.yScale(Linear.class)).stackMode(ScaleStackMode.VALUE);
|
||||
|
||||
polar.tooltip()
|
||||
.valuePrefix("$")
|
||||
.displayMode(TooltipDisplayMode.UNION);
|
||||
|
||||
anyChartView.setChart(polar);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
CustomDataEntry(String x, Number value, Number value2, Number value3) {
|
||||
super(x, value);
|
||||
setValue("value2", value2);
|
||||
setValue("value3", value3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Pyramid;
|
||||
import com.anychart.core.ui.Legend;
|
||||
import com.anychart.enums.Align;
|
||||
import com.anychart.enums.LegendLayout;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PyramidActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Pyramid pyramid = AnyChart.pyramid();
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new ValueDataEntry("TV promotion", 6371664));
|
||||
data.add(new ValueDataEntry("Radio promotion", 7216301));
|
||||
data.add(new ValueDataEntry("Advertising leaflets", 1486621));
|
||||
data.add(new ValueDataEntry("Before advertising started", 1386622));
|
||||
|
||||
pyramid.data(data);
|
||||
|
||||
Legend legend = pyramid.legend();
|
||||
legend.enabled(true);
|
||||
legend.position("outside-right");
|
||||
legend.itemsLayout(LegendLayout.VERTICAL);
|
||||
legend.align(Align.TOP);
|
||||
|
||||
pyramid.labels(false);
|
||||
|
||||
anyChartView.setChart(pyramid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.charts.Scatter;
|
||||
import com.anychart.core.scatter.series.Marker;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.enums.Position;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class QuadrantChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Scatter quadrant = AnyChart.quadrant();
|
||||
|
||||
quadrant.padding(35d, 35d, 35d, 35d);
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new QuadrantDataEntry(65, 60, "Tableau"));
|
||||
data.add(new QuadrantDataEntry(68, 57, "Qlik"));
|
||||
data.add(new QuadrantDataEntry(78, 55, "Microsoft"));
|
||||
data.add(new QuadrantDataEntry(65.6, 48, "Alteryx"));
|
||||
data.add(new QuadrantDataEntry(63, 47, "SAS", new Label[]{ new Label("right") }));
|
||||
data.add(new QuadrantDataEntry(64, 43, "SAP"));
|
||||
data.add(new QuadrantDataEntry(28, "IBM", new Label[]{ new Label("bottom", 0) }));
|
||||
data.add(new QuadrantDataEntry(51, 21, "TIBCO Software"));
|
||||
data.add(new QuadrantDataEntry(53.2, 25.8, "Pentaho", new Label[]{ new Label("right") }));
|
||||
data.add(new QuadrantDataEntry(47, 48, "Birst", new Label[]{ new Label("right") }));
|
||||
data.add(new QuadrantDataEntry(37, 43, "Domo", new Label[]{ new Label("right") }));
|
||||
data.add(new QuadrantDataEntry(27.5, "Board International", new Label[]{ new Label("leftTop", -10, 3)}));
|
||||
data.add(new QuadrantDataEntry(35, 26.5, "Sisense", new Label[]{ new Label("rightBottom") }));
|
||||
data.add(new QuadrantDataEntry(30, 16, "Yellowfin", new Label[]{ new Label("right") }));
|
||||
|
||||
Marker marker = quadrant.marker(data);
|
||||
marker.labels()
|
||||
.enabled(true)
|
||||
.fontFamily("Arial")
|
||||
.fontColor("#546e7a");
|
||||
marker.labels()
|
||||
.position("right")
|
||||
.anchor(Anchor.LEFT_CENTER)
|
||||
.offsetX(5d)
|
||||
.offsetY(0d)
|
||||
.format("{%Name}");
|
||||
marker.tooltip(false);
|
||||
|
||||
quadrant.quarters(
|
||||
"{\n" +
|
||||
" rightTop: {\n" +
|
||||
" title: {\n" +
|
||||
" text: 'LEADERS',\n" +
|
||||
" fontColor: '#ff8f00',\n" +
|
||||
" padding: 10\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" rightBottom: {\n" +
|
||||
" title: {\n" +
|
||||
" text: 'VISIONARIES',\n" +
|
||||
" fontColor: '#ff8f00',\n" +
|
||||
" padding: 10\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" leftTop: {\n" +
|
||||
" title: {\n" +
|
||||
" text: 'CHALLENGERS',\n" +
|
||||
" fontColor: '#ff8f00',\n" +
|
||||
" padding: 10\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" leftBottom: {\n" +
|
||||
" title: {\n" +
|
||||
" text: 'NICHE PLAYERS',\n" +
|
||||
" fontColor: '#ff8f00',\n" +
|
||||
" padding: 10\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }");
|
||||
|
||||
com.anychart.core.ui.Label label = quadrant.quarters().leftBottom().label(0d);
|
||||
label.enabled(true);
|
||||
label.useHtml(true);
|
||||
label.position(Position.LEFT_BOTTOM);
|
||||
label.anchor(Anchor.LEFT_CENTER);
|
||||
|
||||
label.offsetX(-20d);
|
||||
label.text("Power to Perform →");
|
||||
label.rotation(-90d);
|
||||
|
||||
label = quadrant.quarters().leftBottom().label(1d);
|
||||
label.enabled(true);
|
||||
label.useHtml(true);
|
||||
label.position(Position.LEFT_BOTTOM);
|
||||
label.anchor(Anchor.LEFT_CENTER);
|
||||
label.offsetY(20d);
|
||||
label.text("Entirety of Representation →");
|
||||
|
||||
anyChartView.setChart(quadrant);
|
||||
}
|
||||
|
||||
private class QuadrantDataEntry extends DataEntry {
|
||||
QuadrantDataEntry(Number x, Number y, String name) {
|
||||
setValue("x", x);
|
||||
setValue("y", y);
|
||||
setValue("name", name);
|
||||
}
|
||||
|
||||
QuadrantDataEntry(Number x, Number y, String name, Label[] labels) {
|
||||
setValue("x", x);
|
||||
setValue("y", y);
|
||||
setValue("name", name);
|
||||
setValue("label", labels);
|
||||
}
|
||||
|
||||
QuadrantDataEntry(Number y, String name, Label[] labels) {
|
||||
setValue("y", y);
|
||||
setValue("name", name);
|
||||
setValue("label", labels);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class Label extends DataEntry {
|
||||
Label(String anchor) {
|
||||
setValue("anchor", anchor);
|
||||
}
|
||||
|
||||
Label(String anchor, Integer offsetX) {
|
||||
setValue("anchor", anchor);
|
||||
setValue("offsetX", offsetX);
|
||||
}
|
||||
|
||||
Label(String anchor, Integer offsetX, Integer offsetY) {
|
||||
setValue("anchor", anchor);
|
||||
setValue("offsetX", offsetX);
|
||||
setValue("offsetY", offsetY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Radar;
|
||||
import com.anychart.core.radar.series.Line;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.Align;
|
||||
import com.anychart.enums.MarkerType;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RadarChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Radar radar = AnyChart.radar();
|
||||
|
||||
radar.title("WoW base stats comparison radar chart: Shaman vs Warrior vs Priest");
|
||||
|
||||
radar.yScale().minimum(0d);
|
||||
radar.yScale().minimumGap(0d);
|
||||
radar.yScale().ticks().interval(50d);
|
||||
|
||||
radar.xAxis().labels().padding(5d, 5d, 5d, 5d);
|
||||
|
||||
radar.legend()
|
||||
.align(Align.CENTER)
|
||||
.enabled(true);
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomDataEntry("Strength", 136, 199, 43));
|
||||
data.add(new CustomDataEntry("Agility", 79, 125, 56));
|
||||
data.add(new CustomDataEntry("Stamina", 149, 173, 101));
|
||||
data.add(new CustomDataEntry("Intellect", 135, 33, 202));
|
||||
data.add(new CustomDataEntry("Spirit", 158, 64, 196));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(data);
|
||||
Mapping shamanData = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping warriorData = set.mapAs("{ x: 'x', value: 'value2' }");
|
||||
Mapping priestData = set.mapAs("{ x: 'x', value: 'value3' }");
|
||||
|
||||
Line shamanLine = radar.line(shamanData);
|
||||
shamanLine.name("Shaman");
|
||||
shamanLine.markers()
|
||||
.enabled(true)
|
||||
.type(MarkerType.CIRCLE)
|
||||
.size(3d);
|
||||
|
||||
Line warriorLine = radar.line(warriorData);
|
||||
warriorLine.name("Warrior");
|
||||
warriorLine.markers()
|
||||
.enabled(true)
|
||||
.type(MarkerType.CIRCLE)
|
||||
.size(3d);
|
||||
|
||||
Line priestLine = radar.line(priestData);
|
||||
priestLine.name("Priest");
|
||||
priestLine.markers()
|
||||
.enabled(true)
|
||||
.type(MarkerType.CIRCLE)
|
||||
.size(3d);
|
||||
|
||||
radar.tooltip().format("Value: {%Value}");
|
||||
|
||||
anyChartView.setChart(radar);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
public CustomDataEntry(String x, Number value, Number value2, Number value3) {
|
||||
super(x, value);
|
||||
setValue("value2", value2);
|
||||
setValue("value3", value3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.charts.Cartesian;
|
||||
import com.anychart.core.cartesian.series.RangeColumn;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RangeChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Cartesian cartesian = AnyChart.cartesian();
|
||||
|
||||
cartesian.title("Coastal Water Temperature \\nin London vs Edinburgh in 2015 (°C)");
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomDataEntry("Jan", 5.8, 7.9, 6.1, 8.9));
|
||||
data.add(new CustomDataEntry("Feb", 4.6, 6.1, 5.5, 8.2));
|
||||
data.add(new CustomDataEntry("Mar", 5.9, 8.1, 5.9, 8.1));
|
||||
data.add(new CustomDataEntry("Apr", 7.8, 10.7, 7.1, 9.8));
|
||||
data.add(new CustomDataEntry("May", 10.5, 13.7, 8.3, 10.7));
|
||||
data.add(new CustomDataEntry("June", 13.8, 17, 10.7, 14.5));
|
||||
data.add(new CustomDataEntry("July", 16.5, 18.5, 12.3, 16.7));
|
||||
data.add(new CustomDataEntry("Aug", 17.8, 19, 14, 16.3));
|
||||
data.add(new CustomDataEntry("Sep", 15.4, 17.8, 13.7, 15.3));
|
||||
data.add(new CustomDataEntry("Oct", 12.7, 15.3, 12.3, 14.4));
|
||||
data.add(new CustomDataEntry("Nov", 9.8, 13, 12.9, 10.7));
|
||||
data.add(new CustomDataEntry("Dec", 9, 10.1, 8.2, 11.1));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(data);
|
||||
Mapping londonData = set.mapAs("{ x: 'x', high: 'londonHigh', low: 'londonLow' }");
|
||||
Mapping edinburgData = set.mapAs("{ x: 'x', high: 'edinburgHigh', low: 'edinburgLow' }");
|
||||
|
||||
RangeColumn columnLondon = cartesian.rangeColumn(londonData);
|
||||
columnLondon.name("London");
|
||||
|
||||
RangeColumn columnEdinburg = cartesian.rangeColumn(edinburgData);
|
||||
columnEdinburg.name("Edinburgh");
|
||||
|
||||
cartesian.xAxis(true);
|
||||
cartesian.yAxis(true);
|
||||
|
||||
cartesian.yScale()
|
||||
.minimum(4d)
|
||||
.maximum(20d);
|
||||
|
||||
cartesian.legend(true);
|
||||
|
||||
cartesian.yGrid(true)
|
||||
.yMinorGrid(true);
|
||||
|
||||
cartesian.tooltip().titleFormat("{%SeriesName} ({%x})");
|
||||
|
||||
anyChartView.setChart(cartesian);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends DataEntry {
|
||||
public CustomDataEntry(String x, Number edinburgHigh, Number edinburgLow, Number londonHigh, Number londonLow) {
|
||||
setValue("x", x);
|
||||
setValue("edinburgHigh", edinburgHigh);
|
||||
setValue("edinburgLow", edinburgLow);
|
||||
setValue("londonHigh", londonHigh);
|
||||
setValue("londonLow", londonLow);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.charts.Resource;
|
||||
import com.anychart.enums.AvailabilityPeriod;
|
||||
import com.anychart.enums.TimeTrackingMode;
|
||||
import com.anychart.sample.R;
|
||||
import com.anychart.scales.calendar.Availability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ResourceChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Resource resource = AnyChart.resource();
|
||||
|
||||
resource.zoomLevel(1d)
|
||||
.timeTrackingMode(TimeTrackingMode.ACTIVITY_PER_CHART)
|
||||
.currentStartDate("2016-09-30");
|
||||
|
||||
resource.resourceListWidth(120);
|
||||
|
||||
resource.calendar().availabilities(new Availability[] {
|
||||
new Availability(AvailabilityPeriod.DAY, (Double) null, 10d, true, (Double) null, (Double) null, 18d),
|
||||
new Availability(AvailabilityPeriod.DAY, (Double) null, 14d, false, (Double) null, (Double) null, 15d),
|
||||
new Availability(AvailabilityPeriod.WEEK, (Double) null, (Double) null, false, 5d, (Double) null, 18d),
|
||||
new Availability(AvailabilityPeriod.WEEK, (Double) null, (Double) null, false, 6d, (Double) null, 18d)
|
||||
});
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
|
||||
data.add(new ResourceDataEntry(
|
||||
"Romario",
|
||||
"Developer",
|
||||
"http://cdn.anychart.com/images/resource-chart/developer-romario.png",
|
||||
new Activity[]{
|
||||
new Activity(
|
||||
"Gantt timeline",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-01", "2016-10-11", 120)
|
||||
},
|
||||
"#62BEC1"),
|
||||
new Activity(
|
||||
"Gantt Connectors events/removal + UI customization",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-01", "2016-10-04", 180)
|
||||
},
|
||||
"#62BEC1"),
|
||||
new Activity(
|
||||
"Chart Facebook sharing",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-01", "2016-10-04", 120)
|
||||
},
|
||||
"#62BEC1"),
|
||||
new Activity(
|
||||
"Chart animation problems",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-05", "2016-10-09", 300)
|
||||
},
|
||||
"#62BEC1"),
|
||||
new Activity(
|
||||
"iPad touch problems",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-12", "2016-10-16", 300),
|
||||
new Interval("2016-10-17", "2016-10-21", 60)
|
||||
},
|
||||
"#62BEC1"),
|
||||
new Activity(
|
||||
"Some improvements for chart labels",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-17", "2016-10-22", 240),
|
||||
new Interval("2016-10-22", "2016-10-26", 240)
|
||||
},
|
||||
"#62BEC1")
|
||||
}));
|
||||
data.add(new ResourceDataEntry(
|
||||
"Antonio",
|
||||
"Developer",
|
||||
"http://cdn.anychart.com/images/resource-chart/developer-antonio.png",
|
||||
new Activity[]{
|
||||
new Activity(
|
||||
"Gantt resource list",
|
||||
new Interval[]{
|
||||
new Interval("2016-09-25", "2016-10-01", 120)
|
||||
},
|
||||
"#EA526F"),
|
||||
new Activity(
|
||||
"Pareto Chart",
|
||||
new Interval[]{
|
||||
new Interval("2016-09-25", "2016-10-05", 240)
|
||||
},
|
||||
"#EA526F"),
|
||||
new Activity(
|
||||
"Chart bug fixes",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-08", "2016-10-25", 180)
|
||||
},
|
||||
"#EA526F"),
|
||||
new Activity(
|
||||
"Chart legend",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-06", "2016-10-12", 120)
|
||||
},
|
||||
"#EA526F")
|
||||
}));
|
||||
data.add(new ResourceDataEntry(
|
||||
"Alejandro",
|
||||
"Developer",
|
||||
"http://cdn.anychart.com/images/resource-chart/developer-alejandro.png",
|
||||
new Activity[]{
|
||||
new Activity(
|
||||
"Pie chart improvement",
|
||||
new Interval[]{
|
||||
new Interval("2016-09-25", "2016-10-02", 120)
|
||||
},
|
||||
"#8789C0"),
|
||||
new Activity(
|
||||
"Pie chart labels problems",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-05", "2016-11-01", 120)
|
||||
},
|
||||
"#8789C0"),
|
||||
new Activity(
|
||||
"Stock chart minor bugs",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-01", "2016-10-10", 120)
|
||||
},
|
||||
"#8789C0"),
|
||||
new Activity(
|
||||
"Chart minor bug fixes",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-20", "2016-11-05", 120)
|
||||
},
|
||||
"#8789C0")
|
||||
}));
|
||||
data.add(new ResourceDataEntry(
|
||||
"Sergio",
|
||||
"Developer",
|
||||
"http://cdn.anychart.com/images/resource-chart/developer-sergio.png",
|
||||
new Activity[]{
|
||||
new Activity(
|
||||
"Gantt logo",
|
||||
new Interval[]{
|
||||
new Interval("2016-09-30", "2016-10-03", 300)
|
||||
},
|
||||
"#E06D06"),
|
||||
new Activity(
|
||||
"Tooltip bug fix",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-04", "2016-10-10", 300)
|
||||
},
|
||||
"#E06D06"),
|
||||
new Activity(
|
||||
"Chart label",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-11", "2016-10-15", 300)
|
||||
},
|
||||
"#E06D06"),
|
||||
new Activity(
|
||||
"Map series labels improvement",
|
||||
new Interval[]{
|
||||
new Interval("2016-10-16", "2016-11-03", 300)
|
||||
},
|
||||
"#E06D06")
|
||||
}));
|
||||
|
||||
resource.data(data);
|
||||
|
||||
anyChartView.setChart(resource);
|
||||
}
|
||||
|
||||
private class ResourceDataEntry extends DataEntry {
|
||||
ResourceDataEntry(String name, String description, String image, Activity[] activities) {
|
||||
setValue("name", name);
|
||||
setValue("description", description);
|
||||
setValue("image", image);
|
||||
setValue("activities", activities);
|
||||
}
|
||||
}
|
||||
|
||||
private class Activity extends DataEntry {
|
||||
Activity(String name, Interval[] intervals, String fill) {
|
||||
setValue("name", name);
|
||||
setValue("intervals", intervals);
|
||||
setValue("fill", fill);
|
||||
}
|
||||
}
|
||||
|
||||
private class Interval extends DataEntry {
|
||||
Interval(String start, String end, Integer minutesPerDay) {
|
||||
setValue("start", start);
|
||||
setValue("end", end);
|
||||
setValue("minutesPerDay", minutesPerDay);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Scatter;
|
||||
import com.anychart.core.scatter.series.Line;
|
||||
import com.anychart.core.scatter.series.Marker;
|
||||
import com.anychart.enums.HoverMode;
|
||||
import com.anychart.enums.MarkerType;
|
||||
import com.anychart.enums.TooltipDisplayMode;
|
||||
import com.anychart.graphics.vector.GradientKey;
|
||||
import com.anychart.graphics.vector.LinearGradientStroke;
|
||||
import com.anychart.graphics.vector.SolidFill;
|
||||
import com.anychart.graphics.vector.text.HAlign;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ScatterChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Scatter scatter = AnyChart.scatter();
|
||||
|
||||
scatter.animation(true);
|
||||
|
||||
scatter.title("System interruptions");
|
||||
|
||||
scatter.xScale()
|
||||
.minimum(1.5d)
|
||||
.maximum(5.5d);
|
||||
// scatter.xScale().tick
|
||||
scatter.yScale()
|
||||
.minimum(40d)
|
||||
.maximum(100d);
|
||||
|
||||
scatter.yAxis(0).title("Waiting time between interruptions (Min)");
|
||||
scatter.xAxis(0)
|
||||
.title("Interruption duration (Min)")
|
||||
.drawFirstLabel(false)
|
||||
.drawLastLabel(false);
|
||||
|
||||
scatter.interactivity()
|
||||
.hoverMode(HoverMode.BY_SPOT)
|
||||
.spotRadius(30d);
|
||||
|
||||
scatter.tooltip().displayMode(TooltipDisplayMode.UNION);
|
||||
|
||||
Marker marker = scatter.marker(getMarkerData());
|
||||
marker.type(MarkerType.TRIANGLE_UP)
|
||||
.size(4d);
|
||||
marker.hovered()
|
||||
.size(7d)
|
||||
.fill(new SolidFill("gold", 1d))
|
||||
.stroke("anychart.color.darken(gold)");
|
||||
marker.tooltip()
|
||||
.hAlign(HAlign.START)
|
||||
.format("Waiting time: ${%Value} min.\\nDuration: ${%X} min.");
|
||||
|
||||
Line scatterSeriesLine = scatter.line(getLineData());
|
||||
|
||||
GradientKey gradientKey[] = new GradientKey[] {
|
||||
new GradientKey("#abcabc", 0d, 1d),
|
||||
new GradientKey("#cbacba", 40d, 1d)
|
||||
};
|
||||
LinearGradientStroke linearGradientStroke = new LinearGradientStroke(0d, null, gradientKey, null, null, true, 1d, 2d);
|
||||
scatterSeriesLine.stroke(linearGradientStroke, 3d, null, (String) null, (String) null);
|
||||
|
||||
anyChartView.setChart(scatter);
|
||||
}
|
||||
|
||||
private List<DataEntry> getLineData() {
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
|
||||
data.add(new ValueDataEntry(1.7, 54.310454158527));
|
||||
data.add(new ValueDataEntry(1.8, 55.2005091829704));
|
||||
data.add(new ValueDataEntry(1.9, 56.0905642074139));
|
||||
data.add(new ValueDataEntry(2, 56.9806192318574));
|
||||
data.add(new ValueDataEntry(2.1, 57.8706742563008));
|
||||
data.add(new ValueDataEntry(2.2, 58.7607292807443));
|
||||
data.add(new ValueDataEntry(2.3, 59.6507843051877));
|
||||
data.add(new ValueDataEntry(2.5, 61.4308943540747));
|
||||
data.add(new ValueDataEntry(2.6, 62.3209493785181));
|
||||
data.add(new ValueDataEntry(2.7, 63.2110044029616));
|
||||
data.add(new ValueDataEntry(2.9, 64.9911144518485));
|
||||
data.add(new ValueDataEntry(3, 65.881169476292));
|
||||
data.add(new ValueDataEntry(3.1, 66.7712245007354));
|
||||
data.add(new ValueDataEntry(3.2, 67.6612795251789));
|
||||
data.add(new ValueDataEntry(3.3, 68.5513345496223));
|
||||
data.add(new ValueDataEntry(3.4, 69.4413895740658));
|
||||
data.add(new ValueDataEntry(3.5, 70.3314445985093));
|
||||
data.add(new ValueDataEntry(3.6, 71.2214996229527));
|
||||
data.add(new ValueDataEntry(3.7, 72.1115546473962));
|
||||
data.add(new ValueDataEntry(3.8, 73.0016096718396));
|
||||
data.add(new ValueDataEntry(3.9, 73.8916646962831));
|
||||
data.add(new ValueDataEntry(4, 74.7817197207266));
|
||||
data.add(new ValueDataEntry(4.1, 75.67177474517));
|
||||
data.add(new ValueDataEntry(4.2, 76.5618297696135));
|
||||
data.add(new ValueDataEntry(4.3, 77.4518847940569));
|
||||
data.add(new ValueDataEntry(4.4, 78.3419398185004));
|
||||
data.add(new ValueDataEntry(4.5, 79.2319948429438));
|
||||
data.add(new ValueDataEntry(4.6, 80.1220498673873));
|
||||
data.add(new ValueDataEntry(4.7, 81.0121048918308));
|
||||
data.add(new ValueDataEntry(4.8, 81.9021599162742));
|
||||
data.add(new ValueDataEntry(4.9, 82.7922149407177));
|
||||
data.add(new ValueDataEntry(5, 83.6822699651611));
|
||||
data.add(new ValueDataEntry(5.1, 84.5723249896046));
|
||||
data.add(new ValueDataEntry(5.2, 85.4623800140481));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private List<DataEntry> getMarkerData() {
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
|
||||
data.add(new ValueDataEntry(4.4, 78));
|
||||
data.add(new ValueDataEntry(3.9, 74));
|
||||
data.add(new ValueDataEntry(4, 68));
|
||||
data.add(new ValueDataEntry(4, 76));
|
||||
data.add(new ValueDataEntry(3.5, 80));
|
||||
data.add(new ValueDataEntry(4.1, 84));
|
||||
data.add(new ValueDataEntry(2.3, 50));
|
||||
data.add(new ValueDataEntry(4.7, 93));
|
||||
data.add(new ValueDataEntry(1.7, 55));
|
||||
data.add(new ValueDataEntry(4.9, 76));
|
||||
data.add(new ValueDataEntry(1.7, 58));
|
||||
data.add(new ValueDataEntry(4.6, 74));
|
||||
data.add(new ValueDataEntry(3.4, 75));
|
||||
data.add(new ValueDataEntry(4.3, 80));
|
||||
data.add(new ValueDataEntry(1.7, 56));
|
||||
data.add(new ValueDataEntry(3.9, 80));
|
||||
data.add(new ValueDataEntry(3.7, 69));
|
||||
data.add(new ValueDataEntry(3.1, 57));
|
||||
data.add(new ValueDataEntry(4, 90));
|
||||
data.add(new ValueDataEntry(1.8, 42));
|
||||
data.add(new ValueDataEntry(4.1, 91));
|
||||
data.add(new ValueDataEntry(1.8, 51));
|
||||
data.add(new ValueDataEntry(3.2, 79));
|
||||
data.add(new ValueDataEntry(1.9, 53));
|
||||
data.add(new ValueDataEntry(4.6, 82));
|
||||
data.add(new ValueDataEntry(2, 51));
|
||||
data.add(new ValueDataEntry(4.5, 76));
|
||||
data.add(new ValueDataEntry(3.9, 82));
|
||||
data.add(new ValueDataEntry(4.3, 84));
|
||||
data.add(new ValueDataEntry(2.3, 53));
|
||||
data.add(new ValueDataEntry(3.8, 86));
|
||||
data.add(new ValueDataEntry(1.9, 51));
|
||||
data.add(new ValueDataEntry(4.6, 85));
|
||||
data.add(new ValueDataEntry(1.8, 45));
|
||||
data.add(new ValueDataEntry(4.7, 88));
|
||||
data.add(new ValueDataEntry(1.8, 51));
|
||||
data.add(new ValueDataEntry(4.6, 80));
|
||||
data.add(new ValueDataEntry(1.9, 49));
|
||||
data.add(new ValueDataEntry(3.5, 82));
|
||||
data.add(new ValueDataEntry(4, 75));
|
||||
data.add(new ValueDataEntry(3.7, 73));
|
||||
data.add(new ValueDataEntry(3.7, 67));
|
||||
data.add(new ValueDataEntry(4.3, 68));
|
||||
data.add(new ValueDataEntry(3.6, 86));
|
||||
data.add(new ValueDataEntry(3.8, 72));
|
||||
data.add(new ValueDataEntry(3.8, 75));
|
||||
data.add(new ValueDataEntry(3.8, 75));
|
||||
data.add(new ValueDataEntry(2.5, 66));
|
||||
data.add(new ValueDataEntry(4.5, 84));
|
||||
data.add(new ValueDataEntry(4.1, 70));
|
||||
data.add(new ValueDataEntry(3.7, 79));
|
||||
data.add(new ValueDataEntry(3.8, 60));
|
||||
data.add(new ValueDataEntry(3.4, 86));
|
||||
data.add(new ValueDataEntry(4, 71));
|
||||
data.add(new ValueDataEntry(2.3, 67));
|
||||
data.add(new ValueDataEntry(4.4, 81));
|
||||
data.add(new ValueDataEntry(4.1, 76));
|
||||
data.add(new ValueDataEntry(4.3, 83));
|
||||
data.add(new ValueDataEntry(3.3, 76));
|
||||
data.add(new ValueDataEntry(2, 55));
|
||||
data.add(new ValueDataEntry(4.3, 73));
|
||||
data.add(new ValueDataEntry(2.9, 56));
|
||||
data.add(new ValueDataEntry(4.6, 83));
|
||||
data.add(new ValueDataEntry(1.9, 57));
|
||||
data.add(new ValueDataEntry(3.6, 71));
|
||||
data.add(new ValueDataEntry(3.7, 72));
|
||||
data.add(new ValueDataEntry(3.7, 77));
|
||||
data.add(new ValueDataEntry(1.8, 55));
|
||||
data.add(new ValueDataEntry(4.6, 75));
|
||||
data.add(new ValueDataEntry(3.5, 73));
|
||||
data.add(new ValueDataEntry(4, 70));
|
||||
data.add(new ValueDataEntry(3.7, 83));
|
||||
data.add(new ValueDataEntry(1.7, 50));
|
||||
data.add(new ValueDataEntry(4.6, 95));
|
||||
data.add(new ValueDataEntry(1.7, 51));
|
||||
data.add(new ValueDataEntry(4, 82));
|
||||
data.add(new ValueDataEntry(1.8, 54));
|
||||
data.add(new ValueDataEntry(4.4, 83));
|
||||
data.add(new ValueDataEntry(1.9, 51));
|
||||
data.add(new ValueDataEntry(4.6, 80));
|
||||
data.add(new ValueDataEntry(2.9, 78));
|
||||
data.add(new ValueDataEntry(3.5, 81));
|
||||
data.add(new ValueDataEntry(2, 53));
|
||||
data.add(new ValueDataEntry(4.3, 89));
|
||||
data.add(new ValueDataEntry(1.8, 44));
|
||||
data.add(new ValueDataEntry(4.1, 78));
|
||||
data.add(new ValueDataEntry(1.8, 61));
|
||||
data.add(new ValueDataEntry(4.7, 73));
|
||||
data.add(new ValueDataEntry(4.2, 75));
|
||||
data.add(new ValueDataEntry(3.9, 73));
|
||||
data.add(new ValueDataEntry(4.3, 76));
|
||||
data.add(new ValueDataEntry(1.8, 55));
|
||||
data.add(new ValueDataEntry(4.5, 86));
|
||||
data.add(new ValueDataEntry(2, 48));
|
||||
data.add(new ValueDataEntry(4.2, 77));
|
||||
data.add(new ValueDataEntry(4.4, 73));
|
||||
data.add(new ValueDataEntry(4.1, 70));
|
||||
data.add(new ValueDataEntry(4.1, 88));
|
||||
data.add(new ValueDataEntry(4, 75));
|
||||
data.add(new ValueDataEntry(4.1, 83));
|
||||
data.add(new ValueDataEntry(2.7, 61));
|
||||
data.add(new ValueDataEntry(4.6, 78));
|
||||
data.add(new ValueDataEntry(1.9, 61));
|
||||
data.add(new ValueDataEntry(4.5, 81));
|
||||
data.add(new ValueDataEntry(2, 51));
|
||||
data.add(new ValueDataEntry(4.8, 80));
|
||||
data.add(new ValueDataEntry(4.1, 79));
|
||||
data.add(new ValueDataEntry(4.1, 82));
|
||||
data.add(new ValueDataEntry(4.2, 80));
|
||||
data.add(new ValueDataEntry(4.5, 76));
|
||||
data.add(new ValueDataEntry(1.9, 56));
|
||||
data.add(new ValueDataEntry(4.7, 82));
|
||||
data.add(new ValueDataEntry(2, 47));
|
||||
data.add(new ValueDataEntry(4.7, 76));
|
||||
data.add(new ValueDataEntry(2.5, 61));
|
||||
data.add(new ValueDataEntry(4.3, 75));
|
||||
data.add(new ValueDataEntry(4.4, 72));
|
||||
data.add(new ValueDataEntry(4.4, 74));
|
||||
data.add(new ValueDataEntry(4.3, 69));
|
||||
data.add(new ValueDataEntry(4.6, 78));
|
||||
data.add(new ValueDataEntry(2.1, 52));
|
||||
data.add(new ValueDataEntry(4.8, 91));
|
||||
data.add(new ValueDataEntry(4.1, 66));
|
||||
data.add(new ValueDataEntry(4, 71));
|
||||
data.add(new ValueDataEntry(4, 75));
|
||||
data.add(new ValueDataEntry(4.4, 81));
|
||||
data.add(new ValueDataEntry(4.1, 77));
|
||||
data.add(new ValueDataEntry(4.3, 74));
|
||||
data.add(new ValueDataEntry(4, 70));
|
||||
data.add(new ValueDataEntry(3.9, 83));
|
||||
data.add(new ValueDataEntry(3.2, 53));
|
||||
data.add(new ValueDataEntry(4.5, 82));
|
||||
data.add(new ValueDataEntry(2.2, 62));
|
||||
data.add(new ValueDataEntry(4.7, 73));
|
||||
data.add(new ValueDataEntry(4.6, 84));
|
||||
data.add(new ValueDataEntry(2.2, 58));
|
||||
data.add(new ValueDataEntry(4.8, 82));
|
||||
data.add(new ValueDataEntry(4.3, 77));
|
||||
data.add(new ValueDataEntry(3.8, 75));
|
||||
data.add(new ValueDataEntry(4, 77));
|
||||
data.add(new ValueDataEntry(4.1, 77));
|
||||
data.add(new ValueDataEntry(1.8, 53));
|
||||
data.add(new ValueDataEntry(4.4, 75));
|
||||
data.add(new ValueDataEntry(4, 78));
|
||||
data.add(new ValueDataEntry(2.2, 51));
|
||||
data.add(new ValueDataEntry(5.1, 81));
|
||||
data.add(new ValueDataEntry(1.9, 52));
|
||||
data.add(new ValueDataEntry(5, 76));
|
||||
data.add(new ValueDataEntry(4.4, 73));
|
||||
data.add(new ValueDataEntry(4.5, 84));
|
||||
data.add(new ValueDataEntry(3.8, 72));
|
||||
data.add(new ValueDataEntry(4.3, 89));
|
||||
data.add(new ValueDataEntry(4.4, 75));
|
||||
data.add(new ValueDataEntry(2.2, 57));
|
||||
data.add(new ValueDataEntry(4.8, 81));
|
||||
data.add(new ValueDataEntry(1.9, 49));
|
||||
data.add(new ValueDataEntry(4.7, 87));
|
||||
data.add(new ValueDataEntry(1.8, 43));
|
||||
data.add(new ValueDataEntry(4.8, 94));
|
||||
data.add(new ValueDataEntry(2, 45));
|
||||
data.add(new ValueDataEntry(4.4, 81));
|
||||
data.add(new ValueDataEntry(2.5, 59));
|
||||
data.add(new ValueDataEntry(4.3, 82));
|
||||
data.add(new ValueDataEntry(4.4, 80));
|
||||
data.add(new ValueDataEntry(1.9, 54));
|
||||
data.add(new ValueDataEntry(4.7, 75));
|
||||
data.add(new ValueDataEntry(4.3, 73));
|
||||
data.add(new ValueDataEntry(2.2, 57));
|
||||
data.add(new ValueDataEntry(4.7, 80));
|
||||
data.add(new ValueDataEntry(2.3, 51));
|
||||
data.add(new ValueDataEntry(4.6, 77));
|
||||
data.add(new ValueDataEntry(3.3, 66));
|
||||
data.add(new ValueDataEntry(4.2, 77));
|
||||
data.add(new ValueDataEntry(2.9, 60));
|
||||
data.add(new ValueDataEntry(4.6, 86));
|
||||
data.add(new ValueDataEntry(3.3, 62));
|
||||
data.add(new ValueDataEntry(4.2, 75));
|
||||
data.add(new ValueDataEntry(2.6, 67));
|
||||
data.add(new ValueDataEntry(4.6, 69));
|
||||
data.add(new ValueDataEntry(3.7, 84));
|
||||
data.add(new ValueDataEntry(1.8, 58));
|
||||
data.add(new ValueDataEntry(4.7, 90));
|
||||
data.add(new ValueDataEntry(4.5, 82));
|
||||
data.add(new ValueDataEntry(4.5, 71));
|
||||
data.add(new ValueDataEntry(4.8, 80));
|
||||
data.add(new ValueDataEntry(2, 51));
|
||||
data.add(new ValueDataEntry(4.8, 80));
|
||||
data.add(new ValueDataEntry(1.9, 62));
|
||||
data.add(new ValueDataEntry(4.7, 84));
|
||||
data.add(new ValueDataEntry(2, 51));
|
||||
data.add(new ValueDataEntry(5.1, 81));
|
||||
data.add(new ValueDataEntry(4.3, 83));
|
||||
data.add(new ValueDataEntry(4.8, 84));
|
||||
data.add(new ValueDataEntry(3, 72));
|
||||
data.add(new ValueDataEntry(2.1, 54));
|
||||
data.add(new ValueDataEntry(4.6, 75));
|
||||
data.add(new ValueDataEntry(4, 74));
|
||||
data.add(new ValueDataEntry(2.2, 51));
|
||||
data.add(new ValueDataEntry(5.1, 91));
|
||||
data.add(new ValueDataEntry(2.9, 60));
|
||||
data.add(new ValueDataEntry(4.3, 80));
|
||||
data.add(new ValueDataEntry(2.1, 54));
|
||||
data.add(new ValueDataEntry(4.7, 80));
|
||||
data.add(new ValueDataEntry(4.5, 70));
|
||||
data.add(new ValueDataEntry(1.7, 60));
|
||||
data.add(new ValueDataEntry(4.2, 86));
|
||||
data.add(new ValueDataEntry(4.3, 78));
|
||||
data.add(new ValueDataEntry(1.7, 51));
|
||||
data.add(new ValueDataEntry(4.4, 83));
|
||||
data.add(new ValueDataEntry(4.2, 76));
|
||||
data.add(new ValueDataEntry(2.2, 51));
|
||||
data.add(new ValueDataEntry(4.7, 90));
|
||||
data.add(new ValueDataEntry(4, 71));
|
||||
data.add(new ValueDataEntry(1.8, 49));
|
||||
data.add(new ValueDataEntry(4.7, 88));
|
||||
data.add(new ValueDataEntry(1.8, 52));
|
||||
data.add(new ValueDataEntry(4.5, 79));
|
||||
data.add(new ValueDataEntry(2.1, 61));
|
||||
data.add(new ValueDataEntry(4.2, 81));
|
||||
data.add(new ValueDataEntry(2.1, 48));
|
||||
data.add(new ValueDataEntry(5.2, 84));
|
||||
data.add(new ValueDataEntry(2, 63));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.charts.Sunburst;
|
||||
import com.anychart.enums.SunburstCalculationMode;
|
||||
import com.anychart.enums.TreeFillingMethod;
|
||||
import com.anychart.graphics.vector.text.HAlign;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SunburstChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Sunburst sunburst = AnyChart.sunburst();
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomDataEntry("USA", "usa"));
|
||||
data.add(new CustomDataEntry("sales", "usa-sales", "usa"));
|
||||
data.add(new CustomDataEntry("Executive", "usa-executive", "usa-sales", 10));
|
||||
data.add(new CustomDataEntry("Analyst", "usa-analyst", "usa-sales", 15));
|
||||
data.add(new CustomDataEntry("Technical", "usa-technical", "usa"));
|
||||
data.add(new CustomDataEntry("Testers", "usa-testers", "usa-technical", 15));
|
||||
data.add(new CustomDataEntry("Developers", "usa-developers", "usa-technical"));
|
||||
data.add(new CustomDataEntry("Frontend", "usa-frontend", "usa-developers"));
|
||||
data.add(new CustomDataEntry("iOS", "usa-ios", "usa-developers", 12));
|
||||
data.add(new CustomDataEntry("Vue", "vue", "usa-frontend", 7));
|
||||
data.add(new CustomDataEntry("Angular", "angular", "usa-frontend", 12));
|
||||
data.add(new CustomDataEntry("React", "react", "usa-frontend", 23));
|
||||
data.add(new CustomDataEntry("Ember", "ember", "usa-frontend", 5));
|
||||
data.add(new CustomDataEntry("Management", "usa-management", "usa", 37));
|
||||
data.add(new CustomDataEntry("Germany", "germany"));
|
||||
data.add(new CustomDataEntry("Technical", "germany-technical", "germany"));
|
||||
data.add(new CustomDataEntry("Testers", "germany-testers", "germany-technical", 15));
|
||||
data.add(new CustomDataEntry("Developers", "germany-developers", "germany-technical"));
|
||||
data.add(new CustomDataEntry("Android", "germany-android", "germany-developers", 8));
|
||||
data.add(new CustomDataEntry("Backend", "germany-backend", "germany-developers", 8));
|
||||
data.add(new CustomDataEntry("Go", "go", "germany-backend", 8));
|
||||
data.add(new CustomDataEntry("PHP", "php", "germany-backend", 12));
|
||||
data.add(new CustomDataEntry("Python", "python", "germany-backend", 18));
|
||||
data.add(new CustomDataEntry("HR", "germany-hr", "germany", 37));
|
||||
data.add(new CustomDataEntry("Russia", "russia"));
|
||||
data.add(new CustomDataEntry("Sales", "russia-sales", "russia"));
|
||||
data.add(new CustomDataEntry("Technical", "russia-technical", "russia"));
|
||||
data.add(new CustomDataEntry("Testers", "russia-testers", "russia-technical", 15));
|
||||
data.add(new CustomDataEntry("Developers", "russia-developers", "russia-technical"));
|
||||
data.add(new CustomDataEntry("Android", "russia-android", "russia-developers", 12));
|
||||
data.add(new CustomDataEntry("Backend", "russia-backend", "russia-developers"));
|
||||
data.add(new CustomDataEntry("Go", "go", "russia-backend", 4));
|
||||
data.add(new CustomDataEntry("PHP", "php", "russia-backend", 7));
|
||||
data.add(new CustomDataEntry("Python", "python", "russia-backend", 12));
|
||||
data.add(new CustomDataEntry("Executive", "russia-executive", "russia-sales", 8));
|
||||
data.add(new CustomDataEntry("Analyst", "russia-analyst", "russia-sales", 12));
|
||||
data.add(new CustomDataEntry("China", "china"));
|
||||
data.add(new CustomDataEntry("Sales", "china-sales", "china"));
|
||||
data.add(new CustomDataEntry("Technical", "china-technical", "china"));
|
||||
data.add(new CustomDataEntry("Testers", "china-testers", "china-technical", 39));
|
||||
data.add(new CustomDataEntry("Developers", "china-developers", "china-technical"));
|
||||
data.add(new CustomDataEntry("iOS", "china-ios", "china-developers", 17));
|
||||
data.add(new CustomDataEntry("Android", "china-android", "china-developers", 25));
|
||||
data.add(new CustomDataEntry("Backend", "china-backend", "china-developers"));
|
||||
data.add(new CustomDataEntry("Go", "go", "china-backend", 14));
|
||||
data.add(new CustomDataEntry("PHP", "php", "china-backend", 6));
|
||||
data.add(new CustomDataEntry("Python", "python", "china-backend", 17));
|
||||
data.add(new CustomDataEntry("Executive", "china-executive", "china-sales", 35));
|
||||
data.add(new CustomDataEntry("Analyst", "china-analyst", "china-sales", 15));
|
||||
data.add(new CustomDataEntry("Frontend", "china-frontend", "china-developers"));
|
||||
data.add(new CustomDataEntry("Vue", "vue", "china-frontend", 27));
|
||||
data.add(new CustomDataEntry("Angular", "angular", "china-frontend", 21));
|
||||
data.add(new CustomDataEntry("React", "react", "china-frontend", 29));
|
||||
data.add(new CustomDataEntry("Ember", "ember", "china-frontend", 15));
|
||||
data.add(new CustomDataEntry("Meteor", "meteor", "china-frontend", 12));
|
||||
|
||||
// TODO data
|
||||
sunburst.data(data, TreeFillingMethod.AS_TABLE);
|
||||
|
||||
sunburst.calculationMode(SunburstCalculationMode.ORDINAL_FROM_LEAVES);
|
||||
|
||||
sunburst.labels().hAlign(HAlign.CENTER);
|
||||
|
||||
sunburst.palette(new String[] { "#0288d1", "#d4e157", "#ff6e40", "#f8bbd0" });
|
||||
|
||||
sunburst.fill("function () {" +
|
||||
"return this.parent ? anychart.color.darken(this.parentColor, 0.15) : this.mainColor" +
|
||||
"}");
|
||||
|
||||
sunburst.tooltip().format("Employee: {%leavesSum}");
|
||||
|
||||
anyChartView.setChart(sunburst);
|
||||
}
|
||||
|
||||
class CustomDataEntry extends DataEntry {
|
||||
CustomDataEntry(String name, String id) {
|
||||
setValue("name", name);
|
||||
setValue("id", id);
|
||||
}
|
||||
|
||||
CustomDataEntry(String name, String id, String parent) {
|
||||
setValue("name", name);
|
||||
setValue("id", id);
|
||||
setValue("parent", parent);
|
||||
}
|
||||
|
||||
CustomDataEntry(String name, String id, String parent, int value) {
|
||||
setValue("name", name);
|
||||
setValue("id", id);
|
||||
setValue("parent", parent);
|
||||
setValue("value", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.CategoryValueDataEntry;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.charts.TagCloud;
|
||||
import com.anychart.sample.R;
|
||||
import com.anychart.scales.OrdinalColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TagCloudActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
TagCloud tagCloud = AnyChart.tagCloud();
|
||||
|
||||
tagCloud.title("World Population");
|
||||
|
||||
OrdinalColor ordinalColor = OrdinalColor.instantiate();
|
||||
ordinalColor.colors(new String[] {
|
||||
"#26959f", "#f18126", "#3b8ad8", "#60727b", "#e24b26"
|
||||
});
|
||||
tagCloud.colorScale(ordinalColor);
|
||||
tagCloud.angles(new Double[] {-90d, 0d, 90d});
|
||||
|
||||
tagCloud.colorRange().enabled(true);
|
||||
tagCloud.colorRange().colorLineSize(15d);
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CategoryValueDataEntry("China", "asia", 1383220000));
|
||||
data.add(new CategoryValueDataEntry("India", "asia", 1316000000));
|
||||
data.add(new CategoryValueDataEntry("United States", "america", 324982000));
|
||||
data.add(new CategoryValueDataEntry("Indonesia", "asia", 263510000));
|
||||
data.add(new CategoryValueDataEntry("Brazil", "america", 207505000));
|
||||
data.add(new CategoryValueDataEntry("Pakistan", "asia", 196459000));
|
||||
data.add(new CategoryValueDataEntry("Nigeria", "africa", 191836000));
|
||||
data.add(new CategoryValueDataEntry("Bangladesh", "asia", 162459000));
|
||||
data.add(new CategoryValueDataEntry("Russia", "europe", 146804372));
|
||||
data.add(new CategoryValueDataEntry("Japan", "asia", 126790000));
|
||||
data.add(new CategoryValueDataEntry("Mexico", "america", 123518000));
|
||||
data.add(new CategoryValueDataEntry("Ethiopia", "africa", 104345000));
|
||||
data.add(new CategoryValueDataEntry("Philippines", "asia", 104037000));
|
||||
data.add(new CategoryValueDataEntry("Egypt", "africa", 93013300));
|
||||
data.add(new CategoryValueDataEntry("Vietnam", "asia", 92700000));
|
||||
data.add(new CategoryValueDataEntry("Germany", "europe", 82800000));
|
||||
data.add(new CategoryValueDataEntry("Democratic Republic of the Congo", "africa", 82243000));
|
||||
data.add(new CategoryValueDataEntry("Iran", "asia", 80135400));
|
||||
data.add(new CategoryValueDataEntry("Turkey", "asia", 79814871));
|
||||
data.add(new CategoryValueDataEntry("Thailand", "asia", 68298000));
|
||||
data.add(new CategoryValueDataEntry("France", "europe", 67013000));
|
||||
data.add(new CategoryValueDataEntry("United Kingdom", "europe", 65110000));
|
||||
data.add(new CategoryValueDataEntry("Italy", "europe", 60599936));
|
||||
data.add(new CategoryValueDataEntry("Tanzania", "africa", 56878000));
|
||||
data.add(new CategoryValueDataEntry("South Africa", "africa", 55908000));
|
||||
data.add(new CategoryValueDataEntry("Myanmar", "asia", 54836000));
|
||||
data.add(new CategoryValueDataEntry("South Korea", "asia", 51446201));
|
||||
data.add(new CategoryValueDataEntry("Colombia", "america", 49224700));
|
||||
data.add(new CategoryValueDataEntry("Kenya", "africa", 48467000));
|
||||
data.add(new CategoryValueDataEntry("Spain", "europe", 46812000));
|
||||
data.add(new CategoryValueDataEntry("Argentina", "america", 43850000));
|
||||
data.add(new CategoryValueDataEntry("Ukraine", "europe", 42541633));
|
||||
data.add(new CategoryValueDataEntry("Sudan", "africa", 42176000));
|
||||
data.add(new CategoryValueDataEntry("Uganda", "africa", 41653000));
|
||||
data.add(new CategoryValueDataEntry("Algeria", "africa", 41064000));
|
||||
data.add(new CategoryValueDataEntry("Poland", "europe", 38424000));
|
||||
data.add(new CategoryValueDataEntry("Iraq", "asia", 37883543));
|
||||
data.add(new CategoryValueDataEntry("Canada", "america", 36541000));
|
||||
data.add(new CategoryValueDataEntry("Morocco", "africa", 34317500));
|
||||
data.add(new CategoryValueDataEntry("Saudi Arabia", "asia", 33710021));
|
||||
data.add(new CategoryValueDataEntry("Uzbekistan", "asia", 32121000));
|
||||
data.add(new CategoryValueDataEntry("Malaysia", "asia", 32063200));
|
||||
data.add(new CategoryValueDataEntry("Peru", "america", 31826018));
|
||||
data.add(new CategoryValueDataEntry("Venezuela", "america", 31431164));
|
||||
data.add(new CategoryValueDataEntry("Nepal", "asia", 28825709));
|
||||
data.add(new CategoryValueDataEntry("Angola", "africa", 28359634));
|
||||
data.add(new CategoryValueDataEntry("Ghana", "africa", 28308301));
|
||||
data.add(new CategoryValueDataEntry("Yemen", "asia", 28120000));
|
||||
data.add(new CategoryValueDataEntry("Afghanistan", "asia", 27657145));
|
||||
data.add(new CategoryValueDataEntry("Mozambique", "africa", 27128530));
|
||||
data.add(new CategoryValueDataEntry("Australia", "australia", 24460900));
|
||||
data.add(new CategoryValueDataEntry("North Korea", "asia", 24213510));
|
||||
data.add(new CategoryValueDataEntry("Taiwan", "asia", 23545680));
|
||||
data.add(new CategoryValueDataEntry("Cameroon", "africa", 23248044));
|
||||
data.add(new CategoryValueDataEntry("Ivory Coast", "africa", 22671331));
|
||||
data.add(new CategoryValueDataEntry("Madagascar", "africa", 22434363));
|
||||
data.add(new CategoryValueDataEntry("Niger", "africa", 21564000));
|
||||
data.add(new CategoryValueDataEntry("Sri Lanka", "asia", 21203000));
|
||||
data.add(new CategoryValueDataEntry("Romania", "europe", 19760000));
|
||||
data.add(new CategoryValueDataEntry("Burkina Faso", "africa", 19632147));
|
||||
data.add(new CategoryValueDataEntry("Syria", "asia", 18907000));
|
||||
data.add(new CategoryValueDataEntry("Mali", "africa", 18875000));
|
||||
data.add(new CategoryValueDataEntry("Malawi", "africa", 18299000));
|
||||
data.add(new CategoryValueDataEntry("Chile", "america", 18191900));
|
||||
data.add(new CategoryValueDataEntry("Kazakhstan", "asia", 17975800));
|
||||
data.add(new CategoryValueDataEntry("Netherlands", "europe", 17121900));
|
||||
data.add(new CategoryValueDataEntry("Ecuador", "america", 16737700));
|
||||
data.add(new CategoryValueDataEntry("Guatemala", "america", 16176133));
|
||||
data.add(new CategoryValueDataEntry("Zambia", "africa", 15933883));
|
||||
data.add(new CategoryValueDataEntry("Cambodia", "asia", 15626444));
|
||||
data.add(new CategoryValueDataEntry("Senegal", "africa", 15256346));
|
||||
data.add(new CategoryValueDataEntry("Chad", "africa", 14965000));
|
||||
data.add(new CategoryValueDataEntry("Zimbabwe", "africa", 14542235));
|
||||
data.add(new CategoryValueDataEntry("Guinea", "africa", 13291000));
|
||||
data.add(new CategoryValueDataEntry("South Sudan", "africa", 12131000));
|
||||
data.add(new CategoryValueDataEntry("Rwanda", "africa", 11553188));
|
||||
data.add(new CategoryValueDataEntry("Belgium", "europe", 11356191));
|
||||
data.add(new CategoryValueDataEntry("Tunisia", "africa", 11299400));
|
||||
data.add(new CategoryValueDataEntry("Cuba", "america", 11239004));
|
||||
data.add(new CategoryValueDataEntry("Bolivia", "america", 11145770));
|
||||
data.add(new CategoryValueDataEntry("Somalia", "africa", 11079000));
|
||||
data.add(new CategoryValueDataEntry("Haiti", "america", 11078033));
|
||||
data.add(new CategoryValueDataEntry("Greece", "europe", 10783748));
|
||||
data.add(new CategoryValueDataEntry("Benin", "africa", 10653654));
|
||||
data.add(new CategoryValueDataEntry("Czech Republic", "europe", 10578820));
|
||||
data.add(new CategoryValueDataEntry("Portugal", "europe", 10341330));
|
||||
data.add(new CategoryValueDataEntry("Burundi", "africa", 10114505));
|
||||
data.add(new CategoryValueDataEntry("Dominican Republic", "america", 10075045));
|
||||
data.add(new CategoryValueDataEntry("Sweden", "europe", 10054100));
|
||||
data.add(new CategoryValueDataEntry("United Arab Emirates", "asia", 10003223));
|
||||
data.add(new CategoryValueDataEntry("Jordan", "asia", 9889270));
|
||||
data.add(new CategoryValueDataEntry("Azerbaijan", "asia", 9823667));
|
||||
data.add(new CategoryValueDataEntry("Hungary", "europe", 9799000));
|
||||
data.add(new CategoryValueDataEntry("Belarus", "europe", 9498600));
|
||||
data.add(new CategoryValueDataEntry("Honduras", "america", 8866351));
|
||||
data.add(new CategoryValueDataEntry("Austria", "europe", 8773686));
|
||||
data.add(new CategoryValueDataEntry("Tajikistan", "asia", 8742000));
|
||||
data.add(new CategoryValueDataEntry("Israel", "asia", 8690220));
|
||||
data.add(new CategoryValueDataEntry("Switzerland", "europe", 8417700));
|
||||
data.add(new CategoryValueDataEntry("Papua New Guinea", "australia", 8151300));
|
||||
|
||||
tagCloud.data(data);
|
||||
|
||||
anyChartView.setChart(tagCloud);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.SingleValueDataSet;
|
||||
import com.anychart.charts.LinearGauge;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.enums.Orientation;
|
||||
import com.anychart.enums.Position;
|
||||
import com.anychart.sample.R;
|
||||
import com.anychart.scales.Base;
|
||||
import com.anychart.scales.Linear;
|
||||
|
||||
public class ThermometerActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
LinearGauge linearGauge = AnyChart.linear();
|
||||
|
||||
// TODO data
|
||||
linearGauge.data(new SingleValueDataSet(new Integer[] { 2 }));
|
||||
|
||||
linearGauge.tooltip()
|
||||
.useHtml(true)
|
||||
.format(
|
||||
"function () {\n" +
|
||||
" return this.value + '°' + 'C' +\n" +
|
||||
" ' (' + (this.value * 1.8 + 32).toFixed(1) +\n" +
|
||||
" '°' + 'F' + ')'\n" +
|
||||
" }");
|
||||
|
||||
linearGauge.label(0).useHtml(true);
|
||||
linearGauge.label(0)
|
||||
.text("C°")
|
||||
.position(Position.LEFT_BOTTOM)
|
||||
.anchor(Anchor.LEFT_BOTTOM)
|
||||
.offsetY("20px")
|
||||
.offsetX("38%")
|
||||
.fontColor("black")
|
||||
.fontSize(17);
|
||||
|
||||
linearGauge.label(1)
|
||||
.useHtml(true)
|
||||
.text("F°")
|
||||
.position(Position.RIGHT_BOTTOM)
|
||||
.anchor(Anchor.RIGHT_BOTTOM)
|
||||
.offsetY("20px")
|
||||
.offsetX("47.5%")
|
||||
.fontColor("black")
|
||||
.fontSize(17);
|
||||
|
||||
Base scale = linearGauge.scale()
|
||||
.minimum(-30)
|
||||
.maximum(40);
|
||||
// .setTicks
|
||||
|
||||
linearGauge.axis(0).scale(scale);
|
||||
linearGauge.axis(0)
|
||||
.offset("-1%")
|
||||
.width("0.5%");
|
||||
|
||||
linearGauge.axis(0).labels()
|
||||
.format("{%Value}°")
|
||||
.useHtml(true);
|
||||
|
||||
linearGauge.thermometer(0)
|
||||
.name("Thermometer")
|
||||
.id(1);
|
||||
|
||||
linearGauge.axis(0).minorTicks(true);
|
||||
linearGauge.axis(0).labels()
|
||||
.format(
|
||||
"function () {\n" +
|
||||
" return '<span style=\"color:black;\">' + this.value + '°</span>'\n" +
|
||||
" }")
|
||||
.useHtml(true);
|
||||
|
||||
linearGauge.axis(1).minorTicks(true);
|
||||
linearGauge.axis(1).labels()
|
||||
.format(
|
||||
"function () {\n" +
|
||||
" return '<span style=\"color:black;\">' + this.value + '°</span>'\n" +
|
||||
" }")
|
||||
.useHtml(true);
|
||||
linearGauge.axis(1)
|
||||
.offset("3.5%")
|
||||
.orientation(Orientation.RIGHT);
|
||||
|
||||
Linear linear = Linear.instantiate();
|
||||
linear.minimum(-20)
|
||||
.maximum(100);
|
||||
// .setTicks
|
||||
linearGauge.axis(1).scale(linear);
|
||||
|
||||
anyChartView.setChart(linearGauge);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.TreeDataEntry;
|
||||
import com.anychart.charts.TreeMap;
|
||||
import com.anychart.core.ui.Title;
|
||||
import com.anychart.enums.Align;
|
||||
import com.anychart.enums.LegendLayout;
|
||||
import com.anychart.enums.Orientation;
|
||||
import com.anychart.enums.SelectionMode;
|
||||
import com.anychart.enums.TreeFillingMethod;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TreeMapChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
TreeMap treeMap = AnyChart.treeMap();
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomTreeDataEntry("Products by Revenue", null, "Products by Revenue"));
|
||||
data.add(new CustomTreeDataEntry("Fruits", "Products by Revenue", "Fruits", 692000));
|
||||
data.add(new CustomTreeDataEntry("Vegetables", "Products by Revenue", "Vegetables", 597000));
|
||||
data.add(new CustomTreeDataEntry("Dairy", "Products by Revenue", "Dairy", 1359000));
|
||||
data.add(new CustomTreeDataEntry("Meat", "Products by Revenue", "Meat", 596000));
|
||||
data.add(new CustomTreeDataEntry("Apples", "Fruits", "Apples", 138000));
|
||||
data.add(new CustomTreeDataEntry("Oranges", "Fruits", "Oranges", 22000));
|
||||
data.add(new CustomTreeDataEntry("Bananas", "Fruits", "Bananas", 88000));
|
||||
data.add(new CustomTreeDataEntry("Melons", "Fruits", "Melons", 77000));
|
||||
data.add(new CustomTreeDataEntry("Apricots", "Fruits", "Apricots", 48000));
|
||||
data.add(new CustomTreeDataEntry("Plums", "Fruits", "Plums", 48000));
|
||||
data.add(new CustomTreeDataEntry("Pineapples", "Fruits", "Pineapples", 41000));
|
||||
data.add(new CustomTreeDataEntry("Cherries", "Fruits", "Cherries", 39000));
|
||||
data.add(new CustomTreeDataEntry("Tangerines", "Fruits", "Tangerines", 32000));
|
||||
data.add(new CustomTreeDataEntry("Potato", "Vegetables", "Potato", 189000));
|
||||
data.add(new CustomTreeDataEntry("Eggplants", "Vegetables", "Eggplants", 94000));
|
||||
data.add(new CustomTreeDataEntry("Tomatoes", "Vegetables", "Tomatoes", 63000));
|
||||
data.add(new CustomTreeDataEntry("Cucumbers", "Vegetables", "Cucumbers", 43000));
|
||||
data.add(new CustomTreeDataEntry("Cabbage", "Vegetables", "Cabbage", 30000));
|
||||
data.add(new CustomTreeDataEntry("Carrot", "Vegetables", "Carrot", 29000));
|
||||
data.add(new CustomTreeDataEntry("Squash", "Vegetables", "Squash", 26000));
|
||||
data.add(new CustomTreeDataEntry("Capsicums", "Vegetables", "Capsicums", 23000));
|
||||
data.add(new CustomTreeDataEntry("Milk", "Dairy", "Milk", 154000));
|
||||
data.add(new CustomTreeDataEntry("Curd", "Dairy", "Curd", 142000));
|
||||
data.add(new CustomTreeDataEntry("Cheese", "Dairy", "Cheese", 43000));
|
||||
data.add(new CustomTreeDataEntry("Yogurt", "Dairy", "Yogurt", 38000));
|
||||
data.add(new CustomTreeDataEntry("Kefir", "Dairy", "Kefir", 32000));
|
||||
data.add(new CustomTreeDataEntry("Mutton", "Meat", "Mutton", 154000));
|
||||
data.add(new CustomTreeDataEntry("Beef", "Meat", "Beef", 142000));
|
||||
data.add(new CustomTreeDataEntry("Pork", "Meat", "Pork", 43000));
|
||||
data.add(new CustomTreeDataEntry("Veal", "Meat", "Veal", 38000));
|
||||
|
||||
treeMap.data(data, TreeFillingMethod.AS_TABLE);
|
||||
|
||||
Title title = treeMap.title();
|
||||
title.enabled(true);
|
||||
title.useHtml(true);
|
||||
title.padding(0d, 0d, 20d, 0d);
|
||||
title.text("Top ACME Products by Revenue<br/>' +\n" +
|
||||
" '<span style=\"color:#212121; font-size: 13px;\">(average sales during the year, in $)</span>");
|
||||
|
||||
treeMap.colorScale().ranges(new String[]{
|
||||
"{ less: 25000 }",
|
||||
"{ from: 25000, to: 30000 }",
|
||||
"{ from: 30000, to: 40000 }",
|
||||
"{ from: 40000, to: 50000 }",
|
||||
"{ from: 50000, to: 100000 }",
|
||||
"{ greater: 100000 }"
|
||||
});
|
||||
|
||||
treeMap.colorScale().colors(new String[]{
|
||||
"#ffee58", "#fbc02d", "#f57f17", "#c0ca33", "#689f38", "#2e7d32"
|
||||
});
|
||||
|
||||
treeMap.padding(10d, 10d, 10d, 20d);
|
||||
treeMap.maxDepth(2d);
|
||||
treeMap.hovered().fill("#bdbdbd", 1d);
|
||||
treeMap.selectionMode(SelectionMode.NONE);
|
||||
|
||||
treeMap.legend().enabled(true);
|
||||
treeMap.legend()
|
||||
.padding(0d, 0d, 0d, 20d)
|
||||
.position(Orientation.RIGHT)
|
||||
.align(Align.TOP)
|
||||
.itemsLayout(LegendLayout.VERTICAL);
|
||||
|
||||
treeMap.labels().useHtml(true);
|
||||
treeMap.labels().fontColor("#212121");
|
||||
treeMap.labels().fontSize(12d);
|
||||
treeMap.labels().format(
|
||||
"function() {\n" +
|
||||
" return this.getData('product');\n" +
|
||||
" }");
|
||||
|
||||
treeMap.headers().format(
|
||||
"function() {\n" +
|
||||
" return this.getData('product');\n" +
|
||||
" }");
|
||||
|
||||
treeMap.tooltip()
|
||||
.useHtml(true)
|
||||
.titleFormat("{%product}")
|
||||
.format("function() {\n" +
|
||||
" return '<span style=\"color: #bfbfbf\">Revenue: </span>$' +\n" +
|
||||
" anychart.format.number(this.value, {\n" +
|
||||
" groupsSeparator: ' '\n" +
|
||||
" });\n" +
|
||||
" }");
|
||||
|
||||
anyChartView.setChart(treeMap);
|
||||
}
|
||||
|
||||
private class CustomTreeDataEntry extends TreeDataEntry {
|
||||
CustomTreeDataEntry(String id, String parent, String product, Integer value) {
|
||||
super(id, parent, value);
|
||||
setValue("product", product);
|
||||
}
|
||||
|
||||
CustomTreeDataEntry(String id, String parent, String product) {
|
||||
super(id, parent);
|
||||
setValue("product", product);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.anychart.APIlib;
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.chart.common.listener.Event;
|
||||
import com.anychart.chart.common.listener.ListenersInterface;
|
||||
import com.anychart.charts.Cartesian;
|
||||
import com.anychart.charts.Pie;
|
||||
import com.anychart.core.cartesian.series.Column;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.enums.HoverMode;
|
||||
import com.anychart.enums.Position;
|
||||
import com.anychart.enums.TooltipPositionMode;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TwoPiesOneColumnActivity extends AppCompatActivity {
|
||||
|
||||
// private Handler handler;
|
||||
// private Runnable runnable;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_two_pies_one_column);
|
||||
|
||||
final AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
APIlib.getInstance().setActiveAnyChartView(anyChartView);
|
||||
|
||||
final Pie pie = AnyChart.pie();
|
||||
|
||||
pie.setOnClickListener(new ListenersInterface.OnClickListener(new String[]{"x", "value"}) {
|
||||
@Override
|
||||
public void onClick(Event event) {
|
||||
Toast.makeText(TwoPiesOneColumnActivity.this, event.getData().get("x") + ":" + event.getData().get("value"), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new ValueDataEntry("Apples", 6371664));
|
||||
data.add(new ValueDataEntry("Pears", 789622));
|
||||
data.add(new ValueDataEntry("Bananas", 7216301));
|
||||
data.add(new ValueDataEntry("Grapes", 1486621));
|
||||
data.add(new ValueDataEntry("Oranges", 1200000));
|
||||
|
||||
pie.data(data);
|
||||
|
||||
pie.title("Fruits imported in 2015 (in kg)");
|
||||
|
||||
anyChartView.setChart(pie);
|
||||
|
||||
final AnyChartView anyChartView1 = findViewById(R.id.any_chart_view1);
|
||||
APIlib.getInstance().setActiveAnyChartView(anyChartView1);
|
||||
|
||||
final Pie pie1 = AnyChart.pie();
|
||||
|
||||
pie1.setOnClickListener(new ListenersInterface.OnClickListener(new String[]{"x", "value"}) {
|
||||
@Override
|
||||
public void onClick(Event event) {
|
||||
Toast.makeText(TwoPiesOneColumnActivity.this, event.getData().get("x") + ":" + event.getData().get("value"), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
List<DataEntry> data1 = new ArrayList<>();
|
||||
data1.add(new ValueDataEntry("Apples", 6371664));
|
||||
data1.add(new ValueDataEntry("Pears", 789622));
|
||||
data1.add(new ValueDataEntry("Bananas", 7216301));
|
||||
data1.add(new ValueDataEntry("Grapes", 1486621));
|
||||
data1.add(new ValueDataEntry("Oranges", 1200000));
|
||||
|
||||
pie1.data(data1);
|
||||
|
||||
pie1.title("Fruits imported in 2015 (in kg)");
|
||||
|
||||
anyChartView1.setChart(pie1);
|
||||
|
||||
AnyChartView anyChartView2 = findViewById(R.id.any_chart_view2);
|
||||
APIlib.getInstance().setActiveAnyChartView(anyChartView2);
|
||||
|
||||
Cartesian cartesian = AnyChart.column();
|
||||
|
||||
List<DataEntry> data2 = new ArrayList<>();
|
||||
data2.add(new ValueDataEntry("Rouge", 80540));
|
||||
data2.add(new ValueDataEntry("Foundation", 94190));
|
||||
data2.add(new ValueDataEntry("Mascara", 102610));
|
||||
data2.add(new ValueDataEntry("Lip gloss", 110430));
|
||||
data2.add(new ValueDataEntry("Lipstick", 128000));
|
||||
data2.add(new ValueDataEntry("Nail polish", 143760));
|
||||
data2.add(new ValueDataEntry("Eyebrow pencil", 170670));
|
||||
data2.add(new ValueDataEntry("Eyeliner", 213210));
|
||||
data2.add(new ValueDataEntry("Eyeshadows", 249980));
|
||||
|
||||
Column column = cartesian.column(data2);
|
||||
|
||||
column.tooltip()
|
||||
.titleFormat("{%X}")
|
||||
.position(Position.CENTER_BOTTOM)
|
||||
.anchor(Anchor.CENTER_BOTTOM)
|
||||
.offsetX(0d)
|
||||
.offsetY(5d)
|
||||
.format("${%Value}{groupsSeparator: }");
|
||||
|
||||
cartesian.title("Top 10 Cosmetic Products by Revenue");
|
||||
|
||||
cartesian.yScale().minimum(0d);
|
||||
|
||||
cartesian.yAxis(0).labels().format("${%Value}{groupsSeparator: }");
|
||||
|
||||
cartesian.tooltip().positionMode(TooltipPositionMode.POINT);
|
||||
cartesian.interactivity().hoverMode(HoverMode.BY_X);
|
||||
|
||||
cartesian.xAxis(0).title("Product");
|
||||
cartesian.yAxis(0).title("Revenue");
|
||||
|
||||
anyChartView2.setChart(cartesian);
|
||||
|
||||
// final int delayMillis = 500;
|
||||
// handler = new Handler();
|
||||
// runnable = new Runnable() {
|
||||
// public void run() {
|
||||
// APIlib.getInstance().setActiveAnyChartView(anyChartView);
|
||||
// List<DataEntry> data = new ArrayList<>();
|
||||
// data.add(new ValueDataEntry("Apples", new Random().nextDouble() * 140d));
|
||||
// data.add(new ValueDataEntry("Pears", new Random().nextDouble() * 140d));
|
||||
// pie.data(data);
|
||||
// handler.postDelayed(this, delayMillis);
|
||||
//
|
||||
// APIlib.getInstance().setActiveAnyChartView(anyChartView1);
|
||||
// List<DataEntry> data1 = new ArrayList<>();
|
||||
// data1.add(new ValueDataEntry("Apples", new Random().nextDouble() * 140d));
|
||||
// data1.add(new ValueDataEntry("Pears", new Random().nextDouble() * 140d));
|
||||
// pie1.data(data1);
|
||||
// handler.postDelayed(this, delayMillis);
|
||||
// }
|
||||
// };
|
||||
// handler.postDelayed(runnable, delayMillis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
// handler.removeCallbacks(runnable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.NameValueDataEntry;
|
||||
import com.anychart.charts.Venn;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VennDiagramActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Venn venn = AnyChart.venn();
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new NameValueDataEntry("A", "Data Science", 100));
|
||||
data.add(new NameValueDataEntry("B", "Computer Science", 25));
|
||||
data.add(new NameValueDataEntry("C", "Math and Statistics", 25));
|
||||
data.add(new NameValueDataEntry("D", "Subject Matter Expertise", 25));
|
||||
data.add(new NameValueDataEntry("A&B", "Computer Science", 50));
|
||||
data.add(new NameValueDataEntry("A&C", "Math and Statistics", 50));
|
||||
data.add(new NameValueDataEntry("A&D", "Subject Matter Expertise", 50));
|
||||
data.add(new NameValueDataEntry("B&C", "Machine\\nLearning", 5));
|
||||
data.add(new NameValueDataEntry("C&D", "Traditional\\nResearch", 5));
|
||||
data.add(new NameValueDataEntry("D&B", "Traditional\\nSoftware", 5));
|
||||
data.add(new NameValueDataEntry("B&C&D", "Unicorn", 5));
|
||||
|
||||
venn.data(data);
|
||||
|
||||
venn.stroke("2 #FFFFFF");
|
||||
|
||||
venn.labels().format("{%Name}");
|
||||
|
||||
venn.intersections().hovered().fill("black", 0.25d);
|
||||
|
||||
venn.intersections().labels().fontWeight("bold");
|
||||
venn.intersections().labels().format("{%Name}");
|
||||
|
||||
venn.tooltip().titleFormat("{%Name}");
|
||||
|
||||
anyChartView.setChart(venn);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Cartesian;
|
||||
import com.anychart.core.cartesian.series.Bar;
|
||||
import com.anychart.core.cartesian.series.JumpLine;
|
||||
import com.anychart.data.Mapping;
|
||||
import com.anychart.data.Set;
|
||||
import com.anychart.enums.HoverMode;
|
||||
import com.anychart.enums.TooltipDisplayMode;
|
||||
import com.anychart.enums.TooltipPositionMode;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VerticalChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Cartesian vertical = AnyChart.vertical();
|
||||
|
||||
vertical.animation(true)
|
||||
.title("Vertical Combination of Bar and Jump Line Chart");
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new CustomDataEntry("Jan", 11.5, 9.3));
|
||||
data.add(new CustomDataEntry("Feb", 12, 10.5));
|
||||
data.add(new CustomDataEntry("Mar", 11.7, 11.2));
|
||||
data.add(new CustomDataEntry("Apr", 12.4, 11.2));
|
||||
data.add(new CustomDataEntry("May", 13.5, 12.7));
|
||||
data.add(new CustomDataEntry("Jun", 11.9, 13.1));
|
||||
data.add(new CustomDataEntry("Jul", 14.6, 12.2));
|
||||
data.add(new CustomDataEntry("Aug", 17.2, 12.2));
|
||||
data.add(new CustomDataEntry("Sep", 16.9, 10.1));
|
||||
data.add(new CustomDataEntry("Oct", 15.4, 14.5));
|
||||
data.add(new CustomDataEntry("Nov", 16.9, 14.5));
|
||||
data.add(new CustomDataEntry("Dec", 17.2, 15.5));
|
||||
|
||||
Set set = Set.instantiate();
|
||||
set.data(data);
|
||||
Mapping barData = set.mapAs("{ x: 'x', value: 'value' }");
|
||||
Mapping jumpLineData = set.mapAs("{ x: 'x', value: 'jumpLine' }");
|
||||
|
||||
Bar bar = vertical.bar(barData);
|
||||
bar.labels().format("${%Value} mln");
|
||||
|
||||
JumpLine jumpLine = vertical.jumpLine(jumpLineData);
|
||||
jumpLine.stroke("2 #60727B");
|
||||
jumpLine.labels().enabled(false);
|
||||
|
||||
vertical.yScale().minimum(0d);
|
||||
|
||||
vertical.labels(true);
|
||||
|
||||
vertical.tooltip()
|
||||
.displayMode(TooltipDisplayMode.UNION)
|
||||
.positionMode(TooltipPositionMode.POINT)
|
||||
.unionFormat(
|
||||
"function() {\n" +
|
||||
" return 'Plain: $' + this.points[1].value + ' mln' +\n" +
|
||||
" '\\n' + 'Fact: $' + this.points[0].value + ' mln';\n" +
|
||||
" }");
|
||||
|
||||
vertical.interactivity().hoverMode(HoverMode.BY_X);
|
||||
|
||||
vertical.xAxis(true);
|
||||
vertical.yAxis(true);
|
||||
vertical.yAxis(0).labels().format("${%Value} mln");
|
||||
|
||||
anyChartView.setChart(vertical);
|
||||
}
|
||||
|
||||
private class CustomDataEntry extends ValueDataEntry {
|
||||
public CustomDataEntry(String x, Number value, Number jumpLine) {
|
||||
super(x, value);
|
||||
setValue("jumpLine", jumpLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.DataEntry;
|
||||
import com.anychart.chart.common.dataentry.ValueDataEntry;
|
||||
import com.anychart.charts.Waterfall;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WaterfallChartActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
Waterfall waterfall = AnyChart.waterfall();
|
||||
|
||||
waterfall.title("ACME corp. Revenue Flow 2017");
|
||||
|
||||
waterfall.yScale().minimum(0d);
|
||||
|
||||
waterfall.yAxis(0).labels().format("${%Value}{scale:(1000000)(1)|(mln)}");
|
||||
waterfall.labels().enabled(true);
|
||||
waterfall.labels().format(
|
||||
"function() {\n" +
|
||||
" if (this['isTotal']) {\n" +
|
||||
" return anychart.format.number(this.absolute, {\n" +
|
||||
" scale: true\n" +
|
||||
" })\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" return anychart.format.number(this.value, {\n" +
|
||||
" scale: true\n" +
|
||||
" })\n" +
|
||||
" }");
|
||||
|
||||
List<DataEntry> data = new ArrayList<>();
|
||||
data.add(new ValueDataEntry("Start", 23000000));
|
||||
data.add(new ValueDataEntry("Jan", 2200000));
|
||||
data.add(new ValueDataEntry("Feb", -4600000));
|
||||
data.add(new ValueDataEntry("Mar", -9100000));
|
||||
data.add(new ValueDataEntry("Apr", 3700000));
|
||||
data.add(new ValueDataEntry("May", -2100000));
|
||||
data.add(new ValueDataEntry("Jun", 5300000));
|
||||
data.add(new ValueDataEntry("Jul", 3100000));
|
||||
data.add(new ValueDataEntry("Aug", -1500000));
|
||||
data.add(new ValueDataEntry("Sep", 4200000));
|
||||
data.add(new ValueDataEntry("Oct", 5300000));
|
||||
data.add(new ValueDataEntry("Nov", -1500000));
|
||||
data.add(new ValueDataEntry("Dec", 5100000));
|
||||
DataEntry end = new DataEntry();
|
||||
end.setValue("x", "End");
|
||||
end.setValue("isTotal", true);
|
||||
data.add(end);
|
||||
|
||||
waterfall.data(data);
|
||||
|
||||
anyChartView.setChart(waterfall);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.SingleValueDataSet;
|
||||
import com.anychart.charts.CircularGauge;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.graphics.vector.SolidFill;
|
||||
import com.anychart.graphics.vector.text.HAlign;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
public class WindDirectionActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
CircularGauge circularGauge = AnyChart.circular();
|
||||
circularGauge.fill("#fff")
|
||||
.stroke("null")
|
||||
.padding(0, 0, 0, 0)
|
||||
.margin(30, 30, 30, 30)
|
||||
.startAngle(0)
|
||||
.sweepAngle(360);
|
||||
|
||||
circularGauge.data(new SingleValueDataSet(new Double[] { 18.1 }));
|
||||
|
||||
circularGauge.axis(0)
|
||||
.startAngle(0)
|
||||
.radius(80)
|
||||
.sweepAngle(360)
|
||||
.width(3)
|
||||
.drawFirstLabel(false)
|
||||
.ticks("{ type: 'line', length: 4, position: 'outside' }");
|
||||
|
||||
circularGauge.axis(0).labels()
|
||||
.position("outside")
|
||||
.useHtml(true);
|
||||
circularGauge.axis(0).labels().format(
|
||||
"function () {\n" +
|
||||
" return this.value + '°'\n" +
|
||||
" }");
|
||||
|
||||
circularGauge.axis(0).scale()
|
||||
.minimum(0)
|
||||
.maximum(360);
|
||||
circularGauge.axis(0).scale()
|
||||
.ticks("{interval: 45}")
|
||||
.minorTicks("{interval: 10}");
|
||||
|
||||
circularGauge.marker(0)
|
||||
.fill(new SolidFill("#64b5f6", 1))
|
||||
.stroke("null");
|
||||
circularGauge.marker(0)
|
||||
.size(7)
|
||||
.radius(80);
|
||||
|
||||
circularGauge.label(0)
|
||||
.text("<span style=\"font-size: 25\">Wind Direction</span>")
|
||||
.useHtml(true)
|
||||
.hAlign(HAlign.CENTER);
|
||||
circularGauge.label(0)
|
||||
.anchor(Anchor.CENTER_TOP)
|
||||
.offsetY(50)
|
||||
.padding(15, 20, 0, 0);
|
||||
|
||||
circularGauge.label(1)
|
||||
.text("<span style=\"font-size: 20\">18.1</span>")
|
||||
.useHtml(true)
|
||||
.hAlign(HAlign.CENTER);
|
||||
circularGauge.label(1)
|
||||
.anchor(Anchor.CENTER_TOP)
|
||||
.offsetY(-20)
|
||||
.padding(5, 10, 0, 0)
|
||||
.background("{fill: 'none', stroke: '#c1c1c1', corners: 3, cornerType: 'ROUND'}");
|
||||
|
||||
anyChartView.setChart(circularGauge);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.anychart.sample.charts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.anychart.AnyChart;
|
||||
import com.anychart.AnyChartView;
|
||||
import com.anychart.chart.common.dataentry.SingleValueDataSet;
|
||||
import com.anychart.charts.CircularGauge;
|
||||
import com.anychart.enums.Anchor;
|
||||
import com.anychart.graphics.vector.text.HAlign;
|
||||
import com.anychart.sample.R;
|
||||
|
||||
public class WindSpeedActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chart_common);
|
||||
|
||||
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
|
||||
anyChartView.setProgressBar(findViewById(R.id.progress_bar));
|
||||
|
||||
CircularGauge circularGauge = AnyChart.circular();
|
||||
circularGauge.fill("#fff")
|
||||
.stroke(null)
|
||||
.padding(0, 0, 0, 0)
|
||||
.margin(30, 30, 30, 30);
|
||||
circularGauge.startAngle(0)
|
||||
.sweepAngle(360);
|
||||
|
||||
double currentValue = 13.8D;
|
||||
circularGauge.data(new SingleValueDataSet(new Double[] { currentValue }));
|
||||
|
||||
circularGauge.axis(0)
|
||||
.startAngle(-150)
|
||||
.radius(80)
|
||||
.sweepAngle(300)
|
||||
.width(3)
|
||||
.ticks("{ type: 'line', length: 4, position: 'outside' }");
|
||||
|
||||
circularGauge.axis(0).labels().position("outside");
|
||||
|
||||
circularGauge.axis(0).scale()
|
||||
.minimum(0)
|
||||
.maximum(140);
|
||||
|
||||
circularGauge.axis(0).scale()
|
||||
.ticks("{interval: 10}")
|
||||
.minorTicks("{interval: 10}");
|
||||
|
||||
circularGauge.needle(0)
|
||||
.stroke(null)
|
||||
.startRadius("6%")
|
||||
.endRadius("38%")
|
||||
.startWidth("2%")
|
||||
.endWidth(0);
|
||||
|
||||
circularGauge.cap()
|
||||
.radius("4%")
|
||||
.enabled(true)
|
||||
.stroke(null);
|
||||
|
||||
circularGauge.label(0)
|
||||
.text("<span style=\"font-size: 25\">Wind Speed</span>")
|
||||
.useHtml(true)
|
||||
.hAlign(HAlign.CENTER);
|
||||
circularGauge.label(0)
|
||||
.anchor(Anchor.CENTER_TOP)
|
||||
.offsetY(100)
|
||||
.padding(15, 20, 0, 0);
|
||||
|
||||
circularGauge.label(1)
|
||||
.text("<span style=\"font-size: 20\">" + currentValue + "</span>")
|
||||
.useHtml(true)
|
||||
.hAlign(HAlign.CENTER);
|
||||
circularGauge.label(1)
|
||||
.anchor(Anchor.CENTER_TOP)
|
||||
.offsetY(-100)
|
||||
.padding(5, 10, 0, 0)
|
||||
.background("{fill: 'none', stroke: '#c1c1c1', corners: 3, cornerType: 'ROUND'}");
|
||||
|
||||
circularGauge.range(0,
|
||||
"{\n" +
|
||||
" from: 0,\n" +
|
||||
" to: 25,\n" +
|
||||
" position: 'inside',\n" +
|
||||
" fill: 'green 0.5',\n" +
|
||||
" stroke: '1 #000',\n" +
|
||||
" startSize: 6,\n" +
|
||||
" endSize: 6,\n" +
|
||||
" radius: 80,\n" +
|
||||
" zIndex: 1\n" +
|
||||
" }");
|
||||
|
||||
circularGauge.range(1,
|
||||
"{\n" +
|
||||
" from: 80,\n" +
|
||||
" to: 140,\n" +
|
||||
" position: 'inside',\n" +
|
||||
" fill: 'red 0.5',\n" +
|
||||
" stroke: '1 #000',\n" +
|
||||
" startSize: 6,\n" +
|
||||
" endSize: 6,\n" +
|
||||
" radius: 80,\n" +
|
||||
" zIndex: 1\n" +
|
||||
" }");
|
||||
|
||||
anyChartView.setChart(circularGauge);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<com.anychart.AnyChartView
|
||||
android:id="@+id/any_chart_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context="com.anychart.sample.MainActivity">
|
||||
|
||||
<androidx.appcompat.widget.SearchView
|
||||
android:id="@+id/search_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.anychart.sample.charts.TwoPiesOneColumnChartActivity">
|
||||
|
||||
<com.anychart.AnyChartView
|
||||
android:id="@+id/any_chart_view"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="250dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.anychart.AnyChartView
|
||||
android:id="@+id/any_chart_view1"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="250dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/any_chart_view"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.anychart.AnyChartView
|
||||
android:id="@+id/any_chart_view2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/any_chart_view" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:textSize="16sp"
|
||||
tools:text="Name"
|
||||
/>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 26 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FFFFFF</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,46 @@
|
||||
<resources>
|
||||
<string name="app_name">AnyChart</string>
|
||||
<string name="pie_chart">Pie Chart</string>
|
||||
<string name="column_chart">Column Chart</string>
|
||||
<string name="line_chart">Line Chart</string>
|
||||
<string name="venn_diagram">Venn Diagram</string>
|
||||
<string name="heat_map_chart">Heat Map Chart</string>
|
||||
<string name="tag_cloud">Tag Cloud</string>
|
||||
<string name="waterfall_chart">Waterfall Chart</string>
|
||||
<string name="tree_map_chart">Tree Map Chart</string>
|
||||
<string name="circular_gauge">Circular Gauge</string>
|
||||
<string name="thermometer">Thermometer</string>
|
||||
<string name="linear_color_scale">Linear Color Scale</string>
|
||||
<string name="wind_speed">Wind Speed</string>
|
||||
<string name="wind_direction">Wind Direction</string>
|
||||
<string name="scatter_chart">Scatter Chart</string>
|
||||
<string name="resource_chart">Resource Chart</string>
|
||||
<string name="radar_chart">Radar Chart</string>
|
||||
<string name="polar_chart">Polar Chart</string>
|
||||
<string name="range_chart">Range Chart</string>
|
||||
<string name="vertical_chart">Vertical Chart</string>
|
||||
<string name="funnel_chart">Funnel Chart</string>
|
||||
<string name="pert_chart">Pert Chart</string>
|
||||
<string name="gantt_chart">Gantt Chart</string>
|
||||
<string name="combined_chart">Combined Chart</string>
|
||||
<string name="bubble_chart">Bubble Chart</string>
|
||||
<string name="pareto_chart">Pareto Chart</string>
|
||||
<string name="pyramid_chart">Pyramid Chart</string>
|
||||
<string name="area_chart">Area Chart</string>
|
||||
<string name="bar_chart">Bar Chart</string>
|
||||
<string name="box_chart">Box Chart</string>
|
||||
<string name="mosaic_chart">Mosaic Chart</string>
|
||||
<string name="mekko_chart">Mekko Chart</string>
|
||||
<string name="bar3d_chart">3D Bar Chart</string>
|
||||
<string name="column3d_chart">3D Column Chart</string>
|
||||
<string name="area3d_chart">3D Area Chart</string>
|
||||
<string name="hilo_chart">Hilo Chart</string>
|
||||
<string name="ohlc_chart">OHLC Chart</string>
|
||||
<string name="quadrant_chart">Quadrant Chart</string>
|
||||
<string name="bubble_map">Bubble Map</string>
|
||||
<string name="choropleth_map">Choropleth Map</string>
|
||||
<string name="point_map">Point Map</string>
|
||||
<string name="connector_map">Connector Map</string>
|
||||
<string name="sunburst_chart">Sunburst Chart</string>
|
||||
<string name="two_pies_one_column">Two pies one column</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,11 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.anychart.sample;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||