8000 Add color customization by gpfunk · Pull Request #71 · frappe/charts · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add color customization #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 117 additions & 63 deletions dist/frappe-charts.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.cjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.iife.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/js/frappe-charts.min.js

Large diffs are not rendered by default.

23 changes: 11 additions & 12 deletions docs/assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ let bar_composite_data = {

datasets: [{
"title": "Events",
"color": "orange",
"values": report_count_list,
// "formatted": report_count_list.map(d => d + " reports")
}]
Expand All @@ -18,7 +17,6 @@ let bar_composite_data = {
let line_composite_data = {
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
datasets: [{
"color": "green",
"values": [36, 46, 45, 32, 27, 31, 30, 36, 39, 49, 0, 0],
// "values": [36, 46, 45, 32, 27, 31, 30, 36, 39, 49, 40, 40],
// "values": [-36, -46, -45, -32, -27, -31, -30, -36, -39, -49, -40, -40],
Expand Down Expand Up @@ -51,6 +49,7 @@ let bar_composite_chart = new Chart ({
data: bar_composite_data,
type: 'bar',
height: 180,
colors: ['orange'],
is_navigable: 1,
is_series: 1
// region_fill: 1
Expand All @@ -61,6 +60,7 @@ let line_composite_chart = new Chart ({
data: line_composite_data,
type: 'line',
height: 180,
colors: ['green'],
is_series: 1
});

Expand All @@ -77,15 +77,15 @@ let type_data = {

datasets: [
{
title: "Some Data", color: "light-blue",
title: "Some Data",
values: [25, 40, 30, 35, 8, 52, 17, -4]
},
{
title: "Another Set", color: "violet",
title: "Another Set",
values: [25, 50, -10, 15, 18, 32, 27, 14]
},
{
title: "Yet Another", color: "blue",
title: "Yet Another",
values: [15, 20, -3, -15, 58, 12, -17, 37]
}
]
Expand All @@ -97,6 +97,7 @@ let type_chart = new Chart({
data: type_data,
type: 'bar',
height: 250,
colors: ['light-blue', 'violet', 'blue'],
is_series: 1,
format_tooltip_x: d => (d + '').toUpperCase(),
format_tooltip_y: d => d + ' pts'
Expand Down Expand Up @@ -131,7 +132,6 @@ let trends_data = {
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016] ,
datasets: [
{
"color": "blue",
"values": [132.9, 150.0, 149.4, 148.0, 94.4, 97.6, 54.1, 49.2, 22.5, 18.4,
39.3, 131.0, 220.1, 218.9, 198.9, 162.4, 91.0, 60.5, 20.6, 14.8,
33.9, 123.0, 211.1, 191.8, 203.3, 133.0, 76.1, 44.9, 25.1, 11.6,
Expand All @@ -147,6 +147,7 @@ let plot_chart_args = {
data: trends_data,
type: 'line',
height: 250,
colors: ['blue'],
is_series: 1,
show_dots: 0,
heatline: 1,
Expand Down Expand Up @@ -206,7 +207,6 @@ let get_update_data = (source_array, length=10) => {
let update_data = {
labels: get_update_data(update_data_all_labels),
datasets: [{
"color": "red",
"values": get_update_data(update_data_all_values)
}],
"specific_values": [
Expand All @@ -224,6 +224,7 @@ let update_chart = new Chart({
data: update_data,
type: 'line',
height: 250,
colors: ['red'],
is_series: 1,
region_fill: 1
});
Expand Down Expand Up @@ -286,8 +287,6 @@ let events_data = {
labels: ["Ganymede", "Callisto", "Io", "Europa"],
datasets: [
{
// "title": "km",
"color": "grey",
"values": distances,
"formatted": distances.map(d => d*1000 + " km")
}
Expand All @@ -300,6 +299,7 @@ let events_chart = new Chart({
data: events_data,
type: 'bar',
height: 250,
colors: ['grey'],
is_navigable: 1,
});

Expand All @@ -320,11 +320,9 @@ let aggr_data = {
labels: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
datasets: [
{
"color": "purple",
"values": [25, 40, 30, 35, 8, 52, 17]
},
{
"color": "orange",
"values": [25, 50, -10, 15, 18, 32, 27]

}
Expand All @@ -335,7 +333,8 @@ let aggr_chart = new Chart({
parent: "#chart-aggr",
data: aggr_data,
type: 'bar',
height: 250
height: 250,
colors: ['purple', 'orange'],
});

document.querySelector('[data-aggregation="sums"]').addEventListener("click", (e) => {
Expand Down
18 changes: 11 additions & 7 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ <h6 class="margin-vertical-rem">

datasets: [
{
title: "Some Data", color: "light-blue",
title: "Some Data",
values: [25, 40, 30, 35, 8, 52, 17, -4]
},
{
title: "Another Set", color: "violet",
title: "Another Set",
values: [25, 50, -10, 15, 18, 32, 27, 14]
},
{
title: "Yet Another", color: "blue",
title: "Yet Another",
values: [15, 20, -3, -15, 58, 12, -17, 37]
}
]
Expand All @@ -84,6 +84,14 @@ <h6 class="margin-vertical-rem">
data: data,
type: 'bar', // or 'line', 'scatter', 'pie', 'percentage'
height: 250,

colors: ['#7cd6fd', 'violet', 'blue'],
// hex-codes or these preset colors;
// defaults (in order):
// ['light-blue', 'blue', 'violet', 'red',
// 'orange', 'yellow', 'green', 'light-green',
// 'purple', 'magenta', 'grey', 'dark-grey']

format_tooltip_x: d => (d + '').toUpperCase(),
format_tooltip_y: d => d + ' pts'
});</code></pre>
Expand All @@ -98,10 +106,6 @@ <h6 class="margin-vertical-rem">
<p class="text-muted">
<a target="_blank" href="http://www.storytellingwithdata.com/blog/2011/07/death-to-pie-charts">Why Percentage?</a>
</p>

<pre><code class="hljs javascript margin-vertical-px"> // colors: 'green', 'blue', 'violet', 'red', 'orange',
// 'yellow', 'light-blue', 'light-green', 'purple',
// 'magenta', 'grey', 'dark-grey'</code></pre>
</div>
</div>

Expand Down
10 changes: 0 additions & 10 deletions docs/test_data.json

This file was deleted.

Loading
0