Export a Rally Chart as jpeg - rally

Highcharts supports this via exportChart() method, but this is not supported by the rallychart? Is there a work around for now?
var chart = this.down('#chart');
chart.exportChart({
type: 'image/jpeg'
});

Related

Google Maps API 'TypeError: Cannot read properties of undefined (reading 'maps')' when loading component using onMount() in Vue3

I'm creating a Vue app and using Google Maps API to render a map but when I try loading it, I receive the error 'TypeError: Cannot read properties of undefined (reading 'maps')'
I don't know where this error is coming from as I've imported the google map Loader function using:
I'm assuming it's coming from the google object maps property here:
onMounted(async () => {
await loader.load()
new google.maps.Map(mapDiv.value, {
center: currPos.value,
zoom: 14
})
})
I've taken a screenshot of the error
Error from console
I've imported the Loader from google maps in the component itself, and also in the view that renders the component.
import { Loader } from '#googlemaps/js-api-loader'
However, on page load it still throws the error that maps is not found.
'TypeError: Cannot read properties of undefined (reading 'maps')'
The Loader comes from an npm package here:
https://www.npmjs.com/package/#googlemaps/js-api-loader
google variable is not defined in your script, which should be a response, so assign the response from load method to google variable :
onMounted(async () => {
let google = await loader.load()
new google.maps.Map(mapDiv.value, {
center: currPos.value,
zoom: 14
})
})

Cannot read property 'requestContent' of undefined. Epubjs

I used Epubjs. But when I run the application. It turns out "Cannot read property 'requestContent' of undefined". Maybe it is about Asynchronous loading.`
// # is an alias to /src
import Epub from 'epubjs'
global.ePub = Epub
export default {
name: 'home',
mounted () {
this.book = new Epub('/public/东京暗鸦_qinkan.net.epub')
this.book.renderTo('read', {
width: window.innerWidth,
height: window.innerHeight
})
}
}
</script>`
I saw this issue in Chrome and loaded the new code into FF instead and it was showing me a Cross Origins blocked error (which makes sense because I hadn't added that to my API yet).
So this appears to be a chrome issue but might want to look into Cross-origin being blocked in your API.

Event to find out all feature successfully loaded to the layer

I am using OpenLayers6 to load the map on my website. How can I know if all the features in the geojson file completed the loading to the layer?
var layer = new ol.layer.Vector({
source: new ol.source.Vector({
url: "test.geojson",
format: new ol.format.GeoJSON(),
}),
style: function(feature) {
return style;
}
});
map.addLayer(layer);
Is there any event to know that I have completed the loading of all feature inside the "test.geojson" to the layer?

Local storage solutions for large data including images on React Native

Here's the flow of how my end-product should work:
When the user opens the app for the first time, fetch all the data
i.e., including images(150+) and relevant JSON objects.
On opening the app subsequently, the images and data should load
from local storage i.e., no need for internet at all.
I know it seems weird but this is my use case:
The product is a Wayfinder running on Android Box(55-inch touchscreen TV ) which will be placed in the shopping mall. It will not have access to the internet unless I manually connect it.
Hence it should load the data when opening for the first time i.e. when I'm configuring the application.
Solutions I have come across:
Realm: Local database management with excellent support for react-native - my option right now
Native Async Storage: Not suitable for large data
SQLite: Not comfortable with SQL queries
I'm still looking for options on how differently this problem can be tackled. Also, I'm familiar with Redux.
Thanks.
Check out react-native-fs (or expo-file-system if working with expo).
It is specially designed to store files on the device. In your component, it would look something like this:
const RNFS = require('react-native-fs');
RNFS
.downloadFile({ fromUrl: myURL, toFile: myFilePath })
.promise
.then(res => console.log('Done'));
use pouchDB database , this is work with indexDB local browser database
call XHR request for image and convert response to binary data and store in local database
when need to preview image , get from database and make a blobUrl and show in img tag
axios.get(url, {
progress: false, responseType: 'arraybuffer',
onDownloadProgress: (progressEvent) => {
precent = (100 * progressEvent.loaded / progressEvent.total)
console.log(precent)
}
})
.then(resp => {
//get db
let db = $db.dbModel
//set attach
db.get(doc._id).then((doc) => {
db.putAttachment(doc._id, 'index.mp4', doc._rev, new Blob([new Uint8Array(resp.data)], {type: 'video/mp4'}), 'video/mp4')
.then(res => {
// console.log('success store file')
})
})
})
https://github.com/mohammadnazari110/pwa_offline_video_download

Ember Serializer is not serializing embbed records

I am trying to serialize my payload from server, but it is not working.
Here is an example of my payload:
events:[{
id: "57f358856c616cf434fd0500"
annotations:[{_id: "57f358856c616cf434ff0500", desc: "hello world"}]
}]
I want to change annotations _id to id.
Here is my serializer:
//event.js
export default ActiveModelSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs:{
annotations:{embedded:'always'}
}
});
//annotation.js
export default ActiveModelSerializer.extend(DS.EmbeddedRecordsMixin,{
attrs:{
id: '_id',
},
});
Even though I am using DS.EmbeddedRecordsMixin, it still doesn't work. Can anyone help me please? Thank you.
I am assuming whatever versions of ember and ember-data you are using will be making use of the Ember Data 2.0 Serializer (this means using the JSONAPISerializer).
So instead of what you have in your annotations.js I think you want a file in app/serializers/annotation.js, assuming you're not using pods.
// path: app/serializers/annotation.js
import DS from 'ember-data';
export default DS.JSONAPISerializer.extend({
primaryKey: '_id'
});
Working Code Example I created in Ember Twiddle EmbeddedRecords with _id
Ember API reference: http://emberjs.com/api/data/classes/DS.JSONAPISerializer.html#property_primaryKey