Linear gradient in highcharts stockcharts according to full length date - vue.js

Is there anywhere to make linear gradient on full date/year
https://jsfiddle.net/0712nw3g/64/
for example if i move/scroll the graph in 3 month zoom, color gradient should be the same as 1year/all
series: [{
type: 'line',
name: 'Volume',
id: 'stock',
data: volume,
yAxis: 0,
dataGrouping: {
units: groupingUnits
},
lineWidth: 10,
color: {
linearGradient: [0, 0, this.plotWidth, 0],
stops: [
[0, '#26A69A'],
[1, '#CE1510']
]
},
}
]

You can set the options xAxis.events.afterSetExtremes to modify the color gradient in the graph but the color in the navigator also changes.
https://jsfiddle.net/BlackLabel/j3ca7oyh/
Highcharts.getJSON('https://demo-live-data.highcharts.com/aapl-c.json', function(data) {
Highcharts.stockChart('container', {
xAxis: {
events: {
afterSetExtremes: function() {
const dataRange = this.dataMax - this.dataMin,
currentRange = this.max - this.min
this.series[0].update({
color: {
linearGradient: [0, 0, this.plotWidth, 0],
stops: [
[1 - currentRange / dataRange, 'blue'],
[1, 'yellow']
]
},
})
}
}
},
series: [{
name: 'AAPL',
data: data,
color: {
linearGradient: [0, 0, this.plotWidth, 0],
stops: [
[0, 'blue'],
[1, 'yellow']
]
},
}]
});
});
Another way will be adding a series inside the navigator and trying to calculate gradient color.
https://jsfiddle.net/BlackLabel/qLp61uft/
Highcharts.getJSON('https://demo-live-data.highcharts.com/aapl-c.json', function(data) {
Highcharts.stockChart('container', {
xAxis: {
events: {
afterSetExtremes: function() {
const dataRange = this.dataMax - this.dataMin,
currentRange = this.max - this.min
this.series[0].update({
color: {
linearGradient: [0, 0, this.plotWidth, 0],
stops: [
[0, 'red'],
[1, 'yellow']
]
},
})
}
}
},
navigator: {
series: {
name: 'AAPL',
data: data,
fillColor: {
linearGradient: [0, 0, this.plotWidth, 0],
stops: [
[0, 'blue'],
[1, 'yellow']
]
},
}
},
series: [{
name: 'AAPL',
data: data,
color: {
linearGradient: [0, 0, this.plotWidth, 0],
stops: [
[0, 'blue'],
[1, 'yellow']
]
},
}]
});
});

Related

Echarts draw a circle with dashed border on the geo map

I don't know how to convert the unit of the cirle radius, now it's meters but I need to convert it into pixel.
I also want to know how to make the border of the circle become dashed border, like the picture (the circle with the white dashed border)
Here is the code.
const map_data = [];
const current_map_data = [];
this.current_map = this.$echarts.init(document.getElementById('map_id'));
this.$echarts.registerMap('my_map', map_data);
const typhoon_points = [
{name: 0, value: [124.36, 23, 6]},
{name: 1, value: [122, 23.8, 6]},
{name: 2, value: [120, 24.4, 6]},
{name: 3, value: [118.5, 24.8, 6]},
{name: 4, value: [117.2, 25.5, 6]}
];
const typhoon_lines = [
{"point": [0, 1], "coords": [[124.36,23], [122, 23.8]]},
{"point": [1, 2], "coords": [[122, 23.8], [120, 24.4]]},
{"point": [2, 3], "coords": [[120, 24.4], [118.5, 24.8]]},
{"point": [3, 4], "coords": [[118.5, 24.8], [117.2,25.5]]},
];
const option = {
geo: [{
map: map_name,
roam: 'move',
boundingCoords:[ [118, 26.5], [122.4,21.5] ],
center: center,
layoutCenter: ['50%', '50%'],
aspectScale: 1,
scaleLimit: { min: 1.6, max: 12.0 },
left: '0%',
zoom: zoom,
itemStyle: {
areaColor: 'none',
borderColor : '#999',
borderWidth: 1,
emphasis: {
areaColor: 'inherit',
},
},
}],
series: [{
selectedMode: false,
name: 'current_map',
type: 'map',
geoIndex: 0,
data: current_map_data,
zlevel: 3
}, {
name: "",
type: "lines",
zlevel: 6,
lineStyle: {
type: 'solid',
width: 1,
opacity: 1,
curveness: 0,
orient: 'horizontal',
color: "#000",
},
data: typhoon_lines,
}, {
name: '',
type: 'scatter',
coordinateSystem: 'geo',
color: ['#000'],
itemStyle: {
borderType: 'dashed', // it's not working
borderWidth: 50, // The unit of the symbol size is pixel, I need to convert it into pixel.
borderColor: 'green',
color: '#000',
},
data: typhoon_points,
}],
};
I created a line & circle layer into series, but I don't know how to change the border style and the unit of the symbol size (I think it's the radius of the circle)

how can we reconfigure modals using react-native-modalfy separately?

how can we reconfigure modals using react-native-modalfy separately?
like in App.tsx i have configured modal like this below.
I want to change position and animation style for DemoModal2.
import { createModalStack } from 'react-native-modalfy';
const { height } = Dimensions.get('screen');
export const ModalStack = createModalStack({
demo1:DemoModal1,
demo2:DemoModal2
}, {
animateInConfig: {
easing: Easing.inOut(Easing.exp),
duration: 900,
},
animateOutConfig: {
easing: Easing.inOut(Easing.exp),
duration: 900,
},
backdropOpacity: 0.6,
position: 'top',
transitionOptions: (animatedValue) => ({
transform: [
{
translateY: animatedValue.interpolate({
inputRange: [0, 1, 2],
outputRange: [height, 0, height],
}),
},
{
scale: animatedValue.interpolate({
inputRange: [0, 1, 2],
outputRange: [0, 1, 0.9],
}),
},
],
}),
});
similarly there will be more modals. So i need some examples..

Echarts datazoom with grid of 4 charts

I have an eChart grid layout with 4 stacked bar charts and cannot figure out how to assign datazoom (nor have I found any examples of this online).
When I place the datazoom before the series, I DO get a zoom controller but only on one of the charts...
dataZoom: [{type: 'inside', start: 50, end: 100},
{start: 50, end: 100 }
}],
series: [{type: 'scatter'...
I won't post code for now (it's large) in hopes that someone can just tell me where to put the datazoom node.
I have no idea why you charts not working. Without example and with complex data you need to call fortune-teller only. In general datazoom can be easily attached to series.
var myChart = echarts.init(document.getElementById('main'));
var option = {
xAxis: [{
type: 'category',
gridIndex: 0
},
{
type: 'category',
gridIndex: 1
}
],
yAxis: [{
gridIndex: 0
},
{
gridIndex: 1
}
],
dataset: {
source: [
['product', '2012', '2013', '2014', '2015', '2016', '2017'],
['Matcha Latte', 41.1, 30.4, 65.1, 53.3, 83.8, 98.7],
['Milk Tea', 86.5, 92.1, 85.7, 83.1, 73.4, 55.1],
['Cheese Cocoa', 24.1, 67.2, 79.5, 86.4, 65.2, 82.5],
['Walnut Brownie', 55.2, 67.1, 69.2, 72.4, 53.9, 39.1]
]
},
grid: [{
bottom: '55%'
},
{
top: '55%'
}
],
series: [{
type: 'bar',
xAxisIndex: 1,
yAxisIndex: 1,
encode: {
x: 'product',
y: '2012'
}
}, {
type: 'bar',
xAxisIndex: 1,
yAxisIndex: 1,
encode: {
x: 'product',
y: '2013'
}
}, {
type: 'bar',
stack: 'st1',
encode: {
x: 'product',
y: '2014'
}
}, {
type: 'bar',
stack: 'st1',
encode: {
x: 'product',
y: '2015'
}
}],
dataZoom: [{
type: 'slider',
show: true,
xAxisIndex: [0, 1],
start: 1,
end: 70
},
{
type: 'inside',
xAxisIndex: [0, 1],
start: 1,
end: 35
},
],
};
myChart.setOption(option);
<div id="main" style="width: 600px;height:400px;"></div>
<script src="https://cdn.jsdelivr.net/npm/echarts#4.9.0/dist/echarts.min.js"></script>

Place point over boxplot using plotlyjs and vue

I'm trying to place point over boxplot, however my attempt results in the point placed next to the boxplot:
data: [
{
x: [1, 2, 3, 4, 4, 4, 8, 9, 10],
type: "box",
name: "Set 1"
},
{
x: [5],
name: 'My special marker',
text: 'Some really interesting hover info',
marker: {
size: 5
}
},
],
layout: {
title: 'Revenues',
font:{
size:10
},
margin: {
l: 0,
r: 0,
b: 15,
t: 25,
pad: 0
},
height: 90,
dragmode: "pan"
},
Is it possible to place that point over boxplot using vue-plotly library?
Here I recreted the issue:
https://codesandbox.io/s/vue-plotly-delsw?file=/src/App.vue
EDIT:
For the desired result I need that addiotional point to be on top of the chart like this:
One solution is to set the size of the point's marker and the width of the bar such that they overlap each other. For example:
data: [
{
x: [1, 2, 3, 4, 4, 4, 8, 9, 10],
type: "box",
name: "Set 1",
width: 30,
},
{
x: [5],
name: "My special marker",
text: "Some really interesting hover info",
marker: {
size: 30
}
}
],

How to change chart series line color in Dojo?

I am now using Dojo to show a line chart. but I don't know how to change the series line color, would anyone help? thx.
var chart1 = new dc.Chart("test1");
chart1.addPlot("default", { type: "Default", lines: true, markers: true, tension: 1 });
chart1.addAxis("x", { majorTick: { stroke: "black", length: 5 }, minorTick: { stroke: "black", length: 1} });
chart1.addAxis("y", { vertical: true, majorTick: { stroke: "black", length: 5 }, minorTick: { stroke: "black", length: 1} });
chart1.addSeries("Series A", [{ x: 0.5, y: 5 }, { x: 1.5, y: 1.5 }, { x: 2, y: 9 }, { x: 5, y: 0.3}]);
chart1.addSeries("Series B", [{ x: 0.3, y: 8 }, { x: 4, y: 6, tooltip: "Custom tooltip" }, { x: 5.5, y: 2}]);
chart1.addSeries("Series C", [{ x: 0.8, y: 6 }, { x: 8, y: 1, tooltip: "Custom tooltip" }, { x: 7, y: 2}]);
chart1.addSeries("Series D", [{ x: 0.1,y: 5}, { x: 2, y: 3, tooltip: "Custom tooltip" }, { x: 4, y: 5}]);
var anim1a = new dc.action2d.Magnify(chart1, "default");
var anim1b = new dc.action2d.Tooltip(chart1, "default");
chart1.render();
for Series A, Series B,Series C,Series D,I want to use my-defined color to show them, anyone can help?
You can probably also provide the color in your series for it to be used by the plot. Something like the following:
chart1.addSeries("Series A",
[{ x: 0.5, y: 5 }, { x: 1.5, y: 1.5 }, { x: 2, y: 9 }, { x: 5, y: 0.3}],
{ stroke: "green" });
You can change the colors by using the setTheme() function while defining your chart.
Must look like :
require(["dojox/charting/Chart", "dojox/charting/themes/Shrooms", "dojox/charting/plot2d/Areas", ...],
function(Chart, Shrooms, Areas, ...){
new Chart(node)
addPlot("default", { type: Areas, tension: "X" })
setTheme(Shrooms)
addSeries("Series A", [1, 2, 0.5, 1.5, 1, 2.8, 0.4])
addSeries("Series B", [2.6, 1.8, 2, 1, 1.4, 0.7, 2])
addSeries("Series C", [6.3, 1.8, 3, 0.5, 4.4, 2.7, 2])
render();
});
In this example the Theme "Shrooms" will be loaded.
Here you can see, what themes are available for Charts:
http://demos.dojotoolkit.org/demos/chartTypes/demo.html
and in the dojo API you can find them under dojox/charting/themes.
Here's a good tutorial how you can define themes by yourself:
http://dojotoolkit.org/documentation/tutorials/1.9/charting/
Regards, Miriam