Is it possible to display in a chart the axis in reverse, from example the x axis from right to left and the y from left to right? React-chart-js - charts

I am trying to reverse the axis in a chart,what i want is to have to line of the chart running from left to right and the date.now() from right to left? How can i accomplish that?
I have tried to do x: {
reverse: true
},
y:{
reverse: false
}

Actually, you can reverse to arrays. In addition, depending on the situation, You can add new items in reverse.
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'].reverse(),
data: [65, 59, 80, 81, 56, 55, 40].reverse(),

Related

Loading Mapbox Style object from local json file in dash app

Trying to set a Mapbox style from a local JSON file in plotly dash app.
mapbox_token = <mytoken>
local_style=
json.load(open(application_root_path+r'/pages/campaignmap/mapbox_style.json'))
fig = go.Figure(
go.Scattermapbox(
mode="lines", fill="toself",
lon=[-10, -10, 8, 8, -10, None, 30, 30, 50,
50, 30, None, 100, 100, 80, 80, 100],
lat=[30, 6, 6, 30, 30, None, 20, 30, 30, 20, 20, None, 40, 50, 50, 40, 40],))
fig.update_layout(
dict1={"mapbox": {"accesstoken": mapbox_token}})
fig.update_layout(
showlegend=False,
margin={'l': 0, 'r': 0, 'b': 0, 't': 0},
mapbox_style=local_style
)
Based on the documentation on the plotly website Mapbox Map Layers in Python (see image below) this should work. The JSON file contains the export of the style from MapBox and it works fine when I use the service URL (second last dot point in image).
I've tried loading the JSON as string, dictionary and file path in the mapbox_style parameter with no luck.
Any ideas on how to make it load?
I've tried the same things you've described and had no luck. I can provide a style URL and it works perfectly, but if I download that style and provide just the style.json representation of that same style, I can't seem to get Plotly to recognize it...

How can I add custom time line in react native svg charts

I am using react native svg charts to display some data on line chart .the data is associated with some time which need to be labelled on x axis can anybody tell me how can I do it.
When we look at LineChart, it draws the lines like this.
It accepts 50 as points and 10 points and draws a line between
It accepts 10 as points and 40 points and draws a line between
class LineChartExample extends React.PureComponent {
render() {
const data = [50, 10, 40, 95, -4, -24, 85, 91, 35, 53, -53, 24, 50, -20, -80]
return (
<LineChart
style={{ height: 200 }}
data={data}
svg={{ stroke: 'rgb(134, 65, 244)' }}
contentInset={{ top: 20, bottom: 20 }}
>
<Grid />
</LineChart>
)
}
}

Error generating chart: Computation timed out showing in Google Earth Engine

I'm trying to generate a chart of my NDVI values, but I'm getting this error:
Error generating chart: Computation timed out.
This is my code..any help-advice would be really helpful!!
It's important to mention that my AOI file contains more than 500 polygons, that have been converted to a multipolygon..I don't know if this is a problem..
Thanks a lot!
\\Select the ndvi from an Image Collection
var selectNDVI_2020 = getNDVI_2020.select(['NDVI']);
\\Plots NDVI
var plot_index= ui.Chart.image.seriesByRegion(selectNDVI_2020, aoi, ee.Reducer.median(),'NDVI',5000,'system:time_start','system:index')
.setChartType('LineChart').setOptions({
title: 'Δείκτης NDVI για ' + metavliti +' για το έτος 2020',
hAxis: {title: 'Date'},
vAxis: {title: 'NDVI'},
viewWindow : {max : 1, min : 0},
colors: ['blue'],
curveType:'function',
pointSize: 4
});
print(plot_index,'NDVI_2020');
Maybe the AOI is too large for computing.
I change my parameter "scale" from 30 to 300, and find that it was okay.

how to linegraph using result from the previous page

Can i create line graph which is the data get from previous page. I have done a calculation on my previous page. I would like to create line graph using the result and times. I face the problem to adjust the coding below because the coding below show the data was fix.
series: <LineSeries<SalesData, String>>[
LineSeries<SalesData, String>(
dataSource: <SalesData>[
SalesData('Jan', 35),
SalesData('Feb', 28),
SalesData('Mar', 34),
SalesData('Apr', 32),
SalesData('May', 40)
],

Some questions as for vue-chartjs

In Laravel 5.6 / vuejs 2.5 application I use vue-chartjs, but my charts looks like :
https://imgur.com/a/ru1dXlm
I want some more:
having several items(artists in my case) I want to see them half-transparent, just as in first example here http://demo.vue-chartjs.org/
having points with values shown as in first example at link above
I need to see all labels in x-direction( I fill labels parameter ) for here
If there source code of demo examples of link above > I searched and did not find...
Thanks!
Well, you should find everything you need in the documentation of chart.js and vue-chart.js
http://www.chartjs.org/docs/latest/
http://vue-chartjs.org/#/home?id=resources
You can add rgb values as a background color to make them transparent.
You can also use gradients as its just a canvas element.
Here is a tutorial:
https://hackernoon.com/creating-stunning-charts-with-vue-js-and-chart-js-28af584adc0a?source=user_profile---------5----------------
Here is the source code of the vue-chartjs demo page:
https://github.com/apertureless/vue-chartjs-demo
(It's a bit outdated as with v3 the creation of chart components changed a bit)
It seems you did not filled the labels correctly.
{
labels: ['Here', 'are', 'your', 'x-axis', 'labels'],
datasets: [
{
label: 'artist 1',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
data: [0, 1, 2, 3, 4],
},
{
label: 'artist 2',
backgroundColor: 'rgba(255, 99, 132, 0.2)',
data: [0, 1, 2, 3, 4],
},
],
}