Pass the following config to PhantomJS:
{
u'subtitle': {
u'text': u'2016-05-19 12:09 to 2016-05-26 12:09'
},
u'title': {
u'text': u'Query'
},
u'series': [
],
u'yAxis': {
u'title': {
u'text': u'Count'
}
},
u'tooltip': {
u'pointFormat': u'<span style="color:{point.color}">{series.name}</span>: <b>{point.y}</b><br/>'
},
'height': 1000,
u'credits': {
u'enabled': False
},
u'plotOptions': {
u'column': {
u'colorByPoint': False
}
},
u'xAxis': {
u'type': u'category'
},
u'type': u'chart',
u'legend': {
u'enabled': True
}
}
but the output PNG is 1200*800? Why? Anything missing?
Thanks
As already wergeld answered in comments - height is property of chart object in the chart's options (see the API for a reference). So you could use it like this:
{
'chart': {
'height': 1000
},
'subtitle': {
'text': '2016-05-19 12:09 to 2016-05-26 12:09'
},
...rest of your settings...
Related
I found this example that half does what I need. I would need it to show two series, not just one.
events: {
show: function () {
var chart = this.chart,
series = chart.series,
i = series.length,
otherSeries;
while (i--) {
otherSeries = series[i];
if (otherSeries != this && otherSeries.visible) {
otherSeries.hide();
}
}
},
legendItemClick: function() {
if(this.visible){
return false;
}
}
}
http://jsfiddle.net/tK38J/65/
For example: I click series 1 and I see series 1 and 2. I click series 3 and I see series 3 and 4.
Series 2 and 4 will be hidden in the legend.
Is it possible?
You can link series with the same visibility and hide the other ones in legendItemClick event:
plotOptions: {
series: {
events: {
legendItemClick: function() {
if (this.visible) {
return false;
}
this.chart.series.forEach(function(s) {
if (s !== this && s !== this.linkedSeries[0]) {
s.hide();
}
}, this);
}
}
}
},
series: [{
data: [...],
id: 'first'
}, {
data: [...],
linkedTo: 'first'
}, {
data: [...],
visible: false,
id: 'third'
}, {
data: [...],
linkedTo: 'third'
}]
Live demo: http://jsfiddle.net/BlackLabel/s6x37azb/
API Reference: https://api.highcharts.com/highcharts/series.line.linkedTo
I have Customer collection on MongoDB. With status field. Which can have the same Id fields.
And I need find first changed value like 'Guest' and push it Id's to specific pipeline named as 'guests'.
And customers with status 'Member' I need push tu another pipeline named as 'members' who Id'd equal Id's from aggregation pipeline 'guests'.
This is done in order to obtain the quantity elements in 'guests' and 'members'.
Its member item:
{"_id"=>{"$oid"=>"5ce2ecb3ad71852e7fa9e73f"},
"status"=>"member",
"duration"=>nil,
"is_deleted"=>false,
"customer_id"=>"17601",
"customer_journal_item_id"=>"62769",
"customer_ids"=>"17601",
"customer_journal_item_ids"=>"62769",
"self_customer_status_id"=>"21078",
"self_customer_status_created_at"=>"2017-02-01T00:00:00.000Z",
"self_customer_status_updated_at"=>"2017-02-01T00:00:00.000Z",
"updated_at"=>"2019-05-20T18:06:43.655Z",
"created_at"=>"2019-05-20T18:06:43.655Z"}}
My aggregation
{
'$sort': {'self_customer_status_created_at': 1}
},
{'$match':
{
'self_customer_status_created_at':
{
"$gte": Time.parse('2017-01-17').beginning_of_month,
"$lte": Time.parse('2017-01-17').end_of_month
}
}
},
{
"$facet": {
"guests":
[
{
"$group": {
"_id": "$_id",
"data": {
'$first': '$$ROOT'
}
}
},
{
"$match": {
"data.status": "guest"
}
}, {
"$group": {
"_id":nil,
"array":{
"$push": "$data.self_customer_status_id"
}
}
},
{
"$project":{
"array": 1,
"_id":0
}
}
], "members":
[
{
"$group": {
"_id": "$_id", "data": {
'$last': '$$ROOT'
}
}
},
{
"$match": {
"data.status": "member",
"data.self_customer_status_id": {
"$in": [
"$guests.array"
]
}
}
}
}
]
}
}, {
"$project":
{
"members": 1,
"guests.array": 1
}
}
]
).as_json
Instead "guests.array" array? I have error:
Mongo::Error::OperationFailure: $in needs an array (2)
What am I doing wrong?
Sorry my English!
second expression in faced doesnt seen first expression
need delete
,
"data.self_customer_status_id": {
"$in": {
"$arrayElemAt":
[
"$guests.array",
0
]
}
}
{"$match": {"data.self_customer_status_id": { "$in": ["guests.array"] } } }
```
this link paste before $project
Im ploting a 3-pie chart as a single Highchart in a resizable container with VueJs and vue-highcharts component.
To do this, I need then to redefine my pies positions and sizes when the container is resized. Im having a huge struggle in redrawing the pies after I alter my series positions and sizes. Here's some code:
<template>
<div class="multiple-pie-wrapper" ref="root">
<vue-highcharts style="height: 100%; width: 100%;" :Highcharts="Highcharts" :options="options" ref="chart"></vue-highcharts>
</div>
</template>
<script>
import VueHighcharts from 'vue2-highcharts';
import Highcharts from 'highcharts';
export default {
props: {
options: { type: Object, required: true }
},
data: function () {
return {
Highcharts: Highcharts
};
},
components: {
VueHighcharts
},
methods: {
reflow: function() {
var series = this.options.series;
//... Calculate the new positions and sizes and set it to
// series[i].size and series[i].center
// HERE IS WHERE I SHOULD REDRAW IT
}
},
mounted() {
this.reflow();
}
}
</script>
The highchart options:
{
"title":{
"text":"3 Pies"
},
"credits":{
"enabled":false
},
"exporting":{
"enabled":false
},
"series":[
{
"type":"pie",
"data":[
{
"name":"Firefox",
"y":45.0
},
{
"name":"IE",
"y":26.8
},
{
"name":"Chrome",
"y":12.8
},
{
"name":"Safari",
"y":8.5
},
{
"name":"Opera",
"y":6.2
},
{
"name":"Others",
"y":0.7
}
],
"dataLabels":{
"enabled":false
},
"showInLegend":true
},
{
"type":"pie",
"data":[
{
"name":"Firefox",
"y":45.0
},
{
"name":"IE",
"y":26.8
},
{
"name":"Chrome",
"y":12.8
},
{
"name":"Safari",
"y":8.5
},
{
"name":"Opera",
"y":6.2
},
{
"name":"Others",
"y":0.7
}
],
"dataLabels":{
"enabled":false
},
"showInLegend":false
},
{
"type":"pie",
"data":[
{
"name":"Firefox",
"y":45.0
},
{
"name":"IE",
"y":26.8
},
{
"name":"Chrome",
"y":12.8
},
{
"name":"Safari",
"y":8.5
},
{
"name":"Opera",
"y":6.2
},
{
"name":"Others",
"y":0.7
}
],
"dataLabels":{
"enabled":false
},
"showInLegend":false
}
]
}
I have tried the following without success:
this.$refs.chart.chart.redraw()
this.$refs.chart.chart.reflow()
series[i].setData(series)
None of them have any effect and my pies are plotted as if the center and size are the default ones (therefore, overlaping each other).
Any ideas?
I've created a method that does graph redesign.
reloadTypeSeries(){
let pizzaCharts = this.$refs.pizzaCharts;
let updateSeries = JSON.parse(this.updateoptions);
let concatJson = [];
$.each(updateSeries, function(key, value) {
concatJson = concatJson.concat([[updateSeries[key].name, updateSeries[key].y]]);
});
pizzaCharts.chart.series[0].setData(concatJson, true);
}
Hope this helps!
I am trying to build a chart from JS that has multiple "y:" data points in multiple series. I have got the chart working fine using a static configuration, but am struggling to get it to work when adding the points via the API.
I am trying to acheive:
'series':[
{
'name':'Series 1',
'color':'#FF8500',
'data':[
{
'y':1.0002193448599428
},
{
'y':0.4999027241865406
},
{
'y':4.499986649534549
},
{
'y':0.4998817439627601
}
]
},
{
'name':'Series 2',
'color':'#66B3FF',
'data':[
{
'y':12.99999999901047
},
{
'y':13.00000000082946
},
{
'y':18.99999999841384
},
{
'y':5.000000001018634
}
]
},
My code so far looks like this:
var options = {
'chart':{
'renderTo':'MyChart',
'zoomType':'xy',
'defaultSeriesType':'bar',
'width':880
},
<snip>
...
</snip>
'yAxis':{
'title':{
'text':'Seconds'
},
},
'xAxis':{
'title':{
'text':'Objects'
},
'categories': [],
'opposite':true
},
'series':[
{
'name':'Series 1',
'color':'#FF8500',
'data':[]
},
'series':[
{
'name':'Series 2',
'color':'#66B3FF',
'data':[]
}
]
};
options.chart.renderTo = targetdiv;
//Categories add perfectly here:
$.each(harfile.log.entries, function(i, val) {
options.xAxis.categories.push(val.request.url);
console.log(val.request.url);
});
$.each(harfile.log.entries, function(i, val) {
//need to do some logic to catch "-1" for all these values...
options.series[0].data.push("y:" + val.timings.receive);
});
$.each(harfile.log.entries, function(i, val) {
//need to do some logic to catch "-1" for all these values...
options.series[1].data.push(y:" + val.timings.receive);
});
console.log(options.series[0].data);
This produces a "TypeError: Cannot call method 'push' of undefined"
Just use Highcharts API's series.addPoint().
When I am searching my ElasticSearch documents using a nested filter -> and -> geo_distance I retrieve documents which are too far away (and I don't want returned.) You can see the query and a screenshot below of the results (raw results on the left and manually filtered results on the right).
Here's another copy of the query:
{
"query":{
"match_all":{
}
},
"filter":{
"and":[
{
"term":{
"PropertySubType":"Single Family"
}
},
{
"term":{
"City":"Los Angeles"
}
},
{
"geo_distance":{
"distance":"2.25miles",
"Location":[
34.111583657,
-118.324646099
]
}
},
{
"range":{
"BedroomsTotal":{
"gte":3
}
}
},
{
"range":{
"BuildingSize":{
"gte":3000
}
}
},
{
"range":{
"YearBuilt":{
"lte":2000
}
}
},
{
"terms":{
"ListingStatus":[
"Active",
"Pending",
"Closed"
]
}
}
]
},
"size":100
}
Adding the option "distance_type" and setting it to "plane" fixed this issue. See "distance_type" here:
http://www.elasticsearch.org/guide/reference/query-dsl/geo-distance-filter.html