Scatter Highcharts responsive issue Yii2 - highcharts

I am using scatter chart in Yii2 using the following extension
https://github.com/miloschuman/yii2-highcharts
For responsive I have passed parameters like this.
<?php
use miloschuman\highcharts\Highcharts;
echo Highcharts::widget([
'options' => [
'responsive' => [
'rules'=> [
[
'condition'=>
[
'maxWidth' => 500,
],
'chartOptions'=> [
'legend' => [
'enabled'=> true,
'align'=> 'center',
'verticalAlign'=> 'bottom',
'layout'=> 'horizontal',
],
],
]
],
],
]);
?>
But its not working for mobile as well as tablet.Can any one have idea?
Thanks!

Related

Unable to view highcharts in my yii2 project

I have installed the highcharts package in my project. Now I am trying to view a sample chart but I am getting an error.
use miloschuman\highcharts\Highcharts;
<?=
Highcharts::widget([
'options' => [
'title' => ['text' => 'Fruit Consumption'],
'xAxis' => [
'categories' => ['Apples', 'Bananas', 'Oranges']
],
'yAxis' => [
'title' => ['text' => 'Fruit eaten']
],
'series' => [
['name' => 'Jane', 'data' => [1, 0, 4]],
['name' => 'John', 'data' => [5, 7, 3]]
]
]
]);
?>
Error
Invalid Argument – yii\base\InvalidArgumentException
The file or directory to be published does not exist: F:\xampp\htdocs\mdc/vendor\bower/highcharts
Update 1
Below is my stack trace
Update 2
Below is my composer.json
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Project Template",
"keywords": ["yii2", "framework", "advanced", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "~2.0.13",
"yiisoft/yii2-bootstrap": "~2.0.0",
"yiisoft/yii2-swiftmailer": "~2.0.0",
"luoxiaojun1992/yii2-tinker": "*",
"kartik-v/yii2-grid": "#dev",
"kartik-v/yii2-widget-select2": "#dev",
"kartik-v/yii2-mpdf": "dev-master",
"moonlandsoft/yii2-phpexcel": "*",
"nirvana-msu/yii2-showloading": "1.0.*#dev",
"kartik-v/yii2-krajee-base": "^2.0",
"kartik-v/yii2-widget-spinner": "#dev",
"edwinhaq/yii2-simple-loading": "*",
"c006/yii2-submit-spinner": "*",
"kartik-v/yii2-detail-view": "*",
"fedemotta/yii2-cronjob": "*",
"kartik-v/yii2-widget-datetimepicker": "*",
"kartik-v/yii2-date-range": "dev-master",
"phpoffice/phpspreadsheet": "^1.2",
"linslin/yii2-curl": "*",
"kartik-v/yii2-widget-fileinput": "#dev",
"kartik-v/yii2-dialog": "*",
"google/apiclient": "^2.0",
"delight-im/str": "^2.4",
"mongosoft/yii2-soap-client": "dev-master",
"kartik-v/yii2-export": "#dev",
"ext-json": "*",
"miloschuman/yii2-highcharts-widget": "*",
"simialbi/yii2-widget-chart": "^1.0#dev",
"onmotion/yii2-widget-apexcharts": "dev-master",
"2amigos/yii2-chartjs-widget": "~2.0",
"kartik-v/yii2-bootstrap4-dropdown": "#dev",
"practically/yii2-chartjs": "dev-master",
"php-parallel-lint/php-console-color": "dev-master",
"nnnick/chartjs": "v2.9.3"
},
"require-dev": {
"yiisoft/yii2-debug": "~2.0.0",
"yiisoft/yii2-gii": "~2.0.0",
"yiisoft/yii2-faker": "~2.0.0",
"codeception/base": "^2.2.3",
"codeception/verify": "~0.3.1"
},
"config": {
"process-timeout": 1800,
"fxp-asset": {
"enabled": false
}
},
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
},
"scripts": {
"post-install-cmd": "php init --env=Development --overwrite=n"
},
"autoload": {
"psr-4": {
"kartik\\spinner\\": "",
"nirvana\\showloading\\": ""
}
},
"repositories": [{
"type": "composer",
"url": "https://asset-packagist.org"
}]
}
Update 3
Removed highcharts package from composer.json and then executed composer update
F:\xampp\htdocs\mdc>composer require --prefer-dist miloschuman/yii2-highcharts-widget "*"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Installing bower-asset/highcharts (v7.2.1): Loading from cache
- Installing miloschuman/yii2-highcharts-widget (dev-master 260b946): Loading from cache
Package codeception/base is abandoned, you should avoid using it. No replacement was suggested.
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Writing lock file
Generating autoload files
14 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Getting same error
Invalid Argument – yii\base\InvalidArgumentException
The file or directory to be published does not exist: F:\xampp\htdocs\mdc/vendor\bower/highcharts
Update 4
As per #Taron 1st solution I have backend/config/main.php
<?PHP
$params = array_merge(
require(__DIR__ . '/../../common/config/params.php'),
require(__DIR__ . '/../../common/config/params-local.php'),
require(__DIR__ . '/params.php'),
require(__DIR__ . '/params-local.php')
// require(__DIR__ .'/main-local.php')
);
return [
'id' => 'app-backend',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'],
'modules' => [
'gridview' => [
'class' => '\kartik\grid\Module'
],
'api' => [
'class' => 'backend\modules\api\Api',
],
],
'timeZone' => 'Asia/Karachi',
'components' => [
'request' => [
'csrfParam' => '_csrf-backend',
'parsers' => [
'application/json' => 'yii\web\JsonParser',
],
'enableCookieValidation' => false,
'enableCsrfValidation' => false,
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
],
'session' => [
// this is the name of the session cookie used for login on the backend
'name' => 'advanced-backend',
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'urlManager' => [
'class' => 'yii\web\UrlManager',
'showScriptName' => false,
'enablePrettyUrl' => true,
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
],
],
'params' => $params,
];
How can I get rid of this error?
Any help would be highly appreciated
Looks like bower assets stored in path /vendor/bower-assets, but your script tries to load assets from vendor/bower (bower assets path error). Try solution bellow, I hope one of them will help you.
Solution first:
Just add aliases bellow to your config file/files (config/web.php)
'aliases' => [
'#bower' => '#vendor/bower-asset',
'#npm' => '#vendor/npm-asset',
],
Solution second:
Remove composer.lock file
Add package fxp: composer globalrequire "fxp/composer-asset-plugin:~1.1.1"
Reinstall composer: composer --prefer-dist install

Any element in categories Highcharts widget be a link

I have bar chart with Highcharts widget in yii2 project. I want to create hyperlink the category names so that clicking on the label (not the bar) loads the URL in a new window. How can do it?
In Highcharts used label in option but when I use that I get syntax error.
<?php
$x = array("a", "b", "c");
$y = array_values(array(4, 2, 6));
echo Highcharts::widget([
'options' => [
'chart' => [
'type' => 'column',
'zoomType' => 'x',
],
'title' => [
'text' => 'Project chart',
],
'xAxis' => [
'categories' => $x,
],
'yAxis' => [
'title' => [
'text' => 'Count',
],
],
'series' => [
[
'type' => 'column',
'name' => 'p1',
'data' => $y,
],
],
]
]);
?>
I want to each element in $x be a link.
Please tell me what I should do in the code that I posted because they are javascript code and I can't properly use my own code.

Microsoft Graph curl to Excel online

I have an Excel on-line spreadsheet. It's sits on my company's OneDrive.
I'd like to ask is it possible to get value of the specific cell (with formula in it) using Microsoft Graph and simple curl from bash?
The answer is yes. It is possible to get value of the specific cell (with formula in it) using Microsoft Graph and simple curl from bash.
Try the following endpoint:
GET
/{version}/me/drive/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='A1:B2')
authorization: Bearer {access-token} workbook-session-id:
{session-id}
My test request endpoint:
https://graph.microsoft.com/v1.0/me/drive/root:/test.xlsx:/workbook/mysheet/range(address='c1')
Response
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#workbookRange",
"#odata.type": "#microsoft.graph.workbookRange",
"#odata.id": "/me/drive/root/workbook/worksheets(guid)/range(address=%27c1%27)",
"address": "Sheet1!C1",
"addressLocal": "Sheet1!C1",
"cellCount": 1,
"columnCount": 1,
"columnHidden": false,
"columnIndex": 2,
"formulas": [
[
"=SUM(D1,E1)"
]
],
"formulasLocal": [
[
"=SUM(D1,E1)"
]
],
"formulasR1C1": [
[
"=SUM(RC[1],RC[2])"
]
],
"hidden": false,
"numberFormat": [
[
"General"
]
],
"rowCount": 1,
"rowHidden": false,
"rowIndex": 0,
"text": [
[
"3"
]
],
"values": [
[
3
]
],
"valueTypes": [
[
"Double"
]
]
}

Highcharts zones fail to work correctly with yAxis min max values set

Highcharts 5.x.x
I setup zones on a series of data to stop a solid line being drawn at value 0.
This works fine when the yAxis.min and yAxis.max properties are not defined, however after setting those two properties the zones are ignore and a solid line appears.
Toggle comment the yAxis config.
Example
Highcharts.chart('container', {
yAxis: { min: 0, max: 100 },
xAxis: { type: 'datetime' },
series: [
{
data: [
[
1499249640000,
0.003
],
[
1499249700000,
1.9205
],
[
1499249760000,
1.9611
],
[
1499249820000,
1.928
],
[
1499249880000,
0.943
],
[
1499249940000,
0.944
],
[
1499250000000,
0.952
],
[
1499250060000,
0.044
],
[
1499250120000,
0.961
]
],
type: 'area'
},{
zones: [{
value: 0.01,
color: 'rgb(255, 255, 255, 0)'
}],
data: [
[
1499249640000,
0
],
[
1499249700000,
0
],
[
1499249760000,
1.9611
],
[
1499249820000,
0
],
[
1499249880000,
0.943
],
[
1499249940000,
0
],
[
1499250000000,
0
],
[
1499250060000,
0
],
[
1499250120000,
0
]
],
type: 'line'
}]
});

Why is all incoming sms/phone call data repeated in Twilio request?

I'm seeing all the pertinent data for an incoming phone call and sms repeated when I receive requests from Twilio to handle the communication:
{
AccountSid: [ 'xxx', 'xxx' ],
ToZip: [ '30680', '30680' ],
FromState: [ 'NY', 'NY' ],
Called: [ '+111', '+111' ],
FromCountry: [ 'US', 'US' ],
CallerCountry: [ 'US', 'US' ],
CalledZip: [ '30680', '30680' ],
Direction: [ 'inbound', 'inbound' ],
FromCity: [ 'NEW YORK', 'NEW YORK' ],
CalledCountry: [ 'US', 'US' ],
CallerState: [ 'NY', 'NY' ],
CallSid: [ 'xxx', 'xxx' ],
CalledState: [ 'GA', 'GA' ],
From: [ '+222', '+222' ],
CallerZip: [ '10028', '10028' ],
FromZip: [ '10028', '10028' ],
ApplicationSid: [ 'xxx', 'xxx' ],
CallStatus: [ 'ringing', 'ringing' ],
ToCity: [ 'STATHAM', 'STATHAM' ],
ToState: [ 'GA', 'GA' ],
To: [ '+111', '+111' ],
ToCountry: [ 'US', 'US' ],
CallerCity: [ 'NEW YORK', 'NEW YORK' ],
ApiVersion: [ '2010-04-01', '2010-04-01' ],
Caller: [ '+222', '+222' ],
CalledCity: [ 'STATHAM', 'STATHAM' ]
}
This was happening because my webserver redirects all http traffic to https. The redirect causes twilio to repeat the information (like the to and from number). I hope this saves someone the trouble of figuring this out in the future.

Resources