Mpdf issue: Why not work mpdf format,margin,fontsize mPDF\mPDF class value - mpdf

My mPDF Class
$mpdf = new \Mpdf\Mpdf(['utf-8', 'A4-L', 1000000, 'cursive', 100000000000000, 100, 100, 0, 0, 0, 'L']);
I have use mPDF Update version

try it
$mpdf = new \Mpdf\Mpdf([
'tempDir' => __DIR__ . '/pdfdata',
'mode' => 'utf-8',
// 'format' => [24, 24],
'format' => 'A4',
'margin_left' => 0,
'margin_right' => 2,
'margin_bottom' => 2,
'margin_top' => 2,
'float' => 'left'
]);

Related

How to Group a Stacked Column Chart on Google Graphs by Month

I have seen many column and bar charts which are grouped and I have started using Google Graphs for the first time.
I have created a chart showing 2 years data and I need to group the Jan 2018/Jan 2019 beside each other and then a gap and likewise, with the Feb 18/Feb 19 stuck together as column charts - is this possible?
I have created a JSFiddle for this if you want to take a look and see if my logic is correct.
I am using the following format for the data...
var monthdata = google.visualization.arrayToDataTable([
['Month', 'Money Received', 'Money Outstanding', 'Still to be invoiced', 'Ahead of Budget Achieved'],
['January 2019', 9145.600, 1000.400, 0, 900.4],
['January 2018', 8123.100, 0, 0, 0],
['February 2019', 7030.700, 200.300, 999.75, 0],
['February 2018', 7311.190, 0, 0, 0]])
etc... (full code in the JSFilddle section)
many thanks in advance.
there aren't any group options available out of the box.
in order to create a gap between the month pairs,
you could add blank rows to the data table,
in between each pair, e.g.
['January 2019', 9145.600, 1000.400, 0, 900.4],
['January 2018', 8123.100, 0, 0, 0],
[null, null, null, null, null],
['February 2019', 7030.700, 200.300, 999.75, 0],
['February 2018', 7311.190, 0, 0, 0],
[null, null, null, null, null],
['March 2019', 8784.600, 1000.000, 0, 0],
['March 2018', 9945.200, 0, 0, 0],
to bring the month pairs closer together,
you can use the bar.groupWidth option...
bar: {
groupWidth: '90%'
},
see following working snippet...
google.charts.load('current', {
packages: ['corechart']
}).then(drawChart);
function drawChart() {
var monthdata = google.visualization.arrayToDataTable([
['Month', 'Money Received', 'Money Outstanding', 'Still to be invoiced', 'Ahead of Budget Achieved'],
['January 2019', 9145.600, 1000.400, 0, 900.4],
['January 2018', 8123.100, 0, 0, 0],
[null, null, null, null, null],
['February 2019', 7030.700, 200.300, 999.75, 0],
['February 2018', 7311.190, 0, 0, 0],
[null, null, null, null, null],
['March 2019', 8784.600, 1000.000, 0, 0],
['March 2018', 9945.200, 0, 0, 0],
[null, null, null, null, null],
['April 2019', 11398.300, 1019.8300, 0, 1139.83],
['April 2018', 9878.500, 0, 0, 0],
[null, null, null, null, null],
['May 2019', 8486.800, 524.670, 1586.44, 0],
['May 2018', 12050.300, 0, 0, 0],
[null, null, null, null, null],
['June 2019', 10186.0100, 1000.4000, 423.3, 0],
['June 2018', 10321.120, 0, 0, 0],
[null, null, null, null, null],
['July 2019', 11287.2200, 1823.8800, 0, 1212.99],
['July 2018', 11555.000, 0, 0, 0],
[null, null, null, null, null],
['August 2019', 8491.1600, 892.1200, 2197.88, 0],
['August 2018', 11288.120, 0, 0, 0],
[null, null, null, null, null],
['September 2019', 6496.3300, 4221.3200, 0, 132.44],
['September 2018', 13892.500, 0, 0, 0],
[null, null, null, null, null],
['October 2019', 4905.5300, 2121.1200, 1878.88, 0],
['October 2018', 8723.100, 0, 0, 0],
[null, null, null, null, null],
['November 2019', 3296.7000, 1834.1200, 3165.88, 0],
['November 2018', 7011.700, 0, 0, 0],
[null, null, null, null, null],
['December 2019', 5110.1000, 1200.3600, 0, 1310.46],
['December 2018', 9382.500, 0, 0, 0]
]);
var options = {
bar: {
groupWidth: '90%'
},
title: 'Invoicing and Revenue',
isStacked: 'true',
legend: {
position: 'top',
alignment: 'start'
},
tooltip: {
isHtml: true
},
hAxis: {
titleTextStyle: {
color: '#78909c'
},
hAxis: {
title: 'Date'
},
slantedText: true,
slantedTextAngle: 70,
gridlines: {
count: 24
},
},
vAxis: {
minValue: 0,
gridlines: {
color: '#cfd8dc',
count: 4
},
vAxis: {
title: '€'
},
title: '€',
titleTextStyle: {
color: '#78909c'
},
baselineColor: 'transparent',
textStyle: {
color: '#1a71a8',
fontName: 'Roboto',
fontSize: '9',
bold: true
}
},
colors: ["#1a71a8", "#7b848e", "#c65217", "#73721c"],
backgroundColor: '#ffffff',
chartArea: {
backgroundColor: "#ffffff",
width: '88%',
height: '68%'
},
animation: {
duration: 1200,
easing: 'linear',
startup: true
}
};
var chart = new google.visualization.ColumnChart(document.getElementById('containerx'));
chart.draw(monthdata, options);
}
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="containerx"></div>

JavaFX GridPane rowspan height error

It seems to me, that GridPane calculates wrong height over its Nodes when I use rowspan.
// 01 - Half OK
final GridPane gp = new GridPane();
gp.add( new Text( "aaa\nbbb\nccc\nddd\neee" ), 0, 0, 1, 2 );
gp.add( new Text( "aaaa1" ), 1, 0, 1, 1 );
gp.add( new Text( "aaaa2" ), 1, 1, 1, 1 );
gp.setGridLinesVisible( true );
new VBox( 8, new Text( "text1" ), gp, new Text( "text2" ) );
"Half OK" because height of "aaaa1" and "aaaa2" differs.
See the picture.
// 02 - BAD
final GridPane gp = new GridPane();
gp.add( new Text( "aaa\nbbb\nccc\nddd\neee" ), 0, 0, 1, 2 );
gp.add( new Text( "aaaa1" ), 1, 0, 1, 1 );
gp.add( new Text( "aaaa2" ), 1, 1, 1, 2 ); // '1' -> '2'
gp.setGridLinesVisible( true );
new VBox( 8, new Text( "text1" ), gp, new Text( "text2" ) );
// 03 - BAD
final GridPane gp = new GridPane();
gp.add( new Text( "aaa\nbbb\nccc\nddd\neee" ), 0, 0, 1, 3 );
gp.add( new Text( "aaaa1" ), 1, 0, 1, 1 );
gp.add( new Text( "aaaa2" ), 1, 1, 1, 2 );
gp.setGridLinesVisible( true );
new VBox( 8, new Text( "text1" ), gp, new Text( "text2" ) );
// 04 - BAD
final GridPane gp = new GridPane();
gp.add( new Text( "aaa\nbbb\nccc\nddd\neee" ), 0, 0, 1, 3 );
gp.add( new Text( "aaaa1" ), 1, 0, 1, 1 );
gp.add( new Text( "aaaa2" ), 1, 1, 1, 2 );
gp.add( new Text( "xxx11" ), 2, 0, 1, 1 );
gp.add( new Text( "xxx21" ), 2, 1, 1, 1 );
gp.add( new Text( "xxx22" ), 2, 2, 1, 1 );
gp.setGridLinesVisible( true );
new VBox( 8, new Text( "text1" ), gp, new Text( "text2" ) );
Is it JavaFX error or something can be fixed?
Image: https://imgur.com/3USWNyQ

Combining values of two different keys [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I have an id that has a match nested deep in a map. I need to locate the match and return that map.
It's a bit more complicated than that though. Inside this large map there are keys called home and away and the id that I have could be nested in either one of those keys.
I'm trying to find a way to essentially flatten those two keys into one so that I can compare against all of the values.
CURRENT ATTEMPT:
Map.take(game, ["away", "home"]) |> Map.get("players")
But this return nil
To be a little more clear:
This is the method I'm using to dig into the map:
defp evaluate_player_points(game, question) do
Map.get(game, "away")
|> Map.get("players")
|> Enum.find(fn %{"id" => id} -> question.player_id == id end)
|> Map.get("statistics")
|> Map.get("points")
end
But as you can see the top Map.get needs to be dynamic to look for either home or away
MAP (I'm posting the entire thing but it's quite large)
%{"attendance" => 13548,
"away" => %{"alias" => "DET", "bonus" => true,
"coaches" => [%{"first_name" => "Charles", "full_name" => "Charles Klask",
"last_name" => "Klask", "position" => "Assistant Coach",
"reference" => "202894"},
%{"first_name" => "Aaron", "full_name" => "Aaron Gray",
"last_name" => "Gray", "position" => "Assistant Coach",
"reference" => "1628254"},
%{"first_name" => "Stan", "full_name" => "Stan Van Gundy",
"id" => "e4abb843-1259-4aee-95f3-2ab748d510e4",
"last_name" => "Van Gundy", "position" => "Head Coach",
"reference" => "1277"},
%{"first_name" => "Bob", "full_name" => "Bob Beyer",
"last_name" => "Beyer", "position" => "Assistant Coach",
"reference" => "2630"},
%{"first_name" => "Jon", "full_name" => "Jon Ishop",
"last_name" => "Ishop", "position" => "Trainer",
"reference" => "202605"},
%{"first_name" => "Otis", "full_name" => "Otis Smith",
"last_name" => "Smith", "position" => "Assistant Coach",
"reference" => "2542"},
%{"first_name" => "Malik", "full_name" => "Malik Allen",
"last_name" => "Allen", "position" => "Assistant Coach",
"reference" => "204229"},
%{"first_name" => "Tim", "full_name" => "Tim Hardaway",
"last_name" => "Hardaway", "position" => "Assistant Coach",
"reference" => "204230"}],
"id" => "583ec928-fb46-11e1-82cb-f4ce4684ea4c", "market" => "Detroit",
"name" => "Pistons",
"players" => [%{"active" => true, "first_name" => "Reggie",
"full_name" => "Reggie Jackson",
"id" => "7b745dde-a011-45a8-98a8-460a9facb3ce", "jersey_number" => "1",
"last_name" => "Jackson", "played" => true, "position" => "G",
"primary_position" => "PG", "reference" => "202704", "starter" => true,
"statistics" => %{"efficiency" => 2, "triple_double" => false,
"defensive_rating" => 110.206452594306, "second_chance_att" => 0,
"points" => 11, "minus" => 60, "points_in_paint_att" => 7,
"blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 0.0, "points_off_turnovers" => 3,
"two_points_att" => 8, "flagrant_fouls" => 0, "steals" => 0,
"fast_break_att" => 1, "offensive_rating" => 89.2874338761532,
"offensive_rebounds" => 0, "second_chance_pct" => 0.0,
"true_shooting_att" => 11.0, "two_points_pct" => 50.0,
"points_in_paint" => 6, "assists_turnover_ratio" => 1.25,
"steals_pct" => 0.0, "rebounds_pct" => 0.0, "field_goals_made" => 5,
"periods" => [%{"efficiency" => 6, "number" => 1, ...},
%{"efficiency" => -3, ...}, %{...}, ...], "offensive_fouls" => 0,
"free_throws_pct" => 0.0, "points_in_paint_made" => 3, ...}},
%{"first_name" => "Luis", "full_name" => "Luis Montero",
"id" => "9304e1de-0d5a-4ccb-9409-100342405041", "jersey_number" => "44",
"last_name" => "Montero", "position" => "G-F",
"primary_position" => "SG", "reference" => "1626242",
"statistics" => %{"efficiency" => 0, "triple_double" => false,
"second_chance_att" => 0, "points" => 0, "minus" => 0,
"points_in_paint_att" => 0, "blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 0.0, "points_off_turnovers" => 0,
"two_points_att" => 0, "flagrant_fouls" => 0, "steals" => 0,
"fast_break_att" => 0, "offensive_rebounds" => 0,
"second_chance_pct" => 0.0, "true_shooting_att" => 0.0,
"two_points_pct" => 0.0, "points_in_paint" => 0,
"assists_turnover_ratio" => 0, "steals_pct" => 0.0,
"rebounds_pct" => 0.0, "field_goals_made" => 0,
"periods" => [%{"efficiency" => 0, "number" => 1,
"second_chance_att" => 0, "points" => 0, "minus" => 0,
"points_in_paint_att" => 0, ...},
%{"efficiency" => 0, "number" => 2, "second_chance_att" => 0,
"points" => 0, "minus" => 0, ...},
%{"efficiency" => 0, "number" => 3, "second_chance_att" => 0,
"points" => 0, ...},
%{"efficiency" => 0, "number" => 4, "second_chance_att" => 0,
"points" => 0, ...}], "offensive_fouls" => 0,
"free_throws_pct" => 0.0, "points_in_paint_made" => 0,
"second_chance_pts" => 0, "true_shooting_pct" => 0,
"free_throws_made" => 0, "three_points_pct" => 0.0, ...}},
%{"active" => true, "first_name" => "Stanley",
"full_name" => "Stanley Johnson",
"id" => "6ed42a42-6fd6-464c-8425-7e40489c679f", "jersey_number" => "7",
"last_name" => "Johnson", "played" => true, "position" => "F",
"primary_position" => "SF", "reference" => "1626169",
"statistics" => %{"efficiency" => 4, "triple_double" => false,
"defensive_rating" => 107.894802391447, "second_chance_att" => 1,
"points" => 2, "minus" => 32, "points_in_paint_att" => 1,
"blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 16.6695606876194,
"points_off_turnovers" => 0, "two_points_att" => 1,
"flagrant_fouls" => 0, "steals" => 0, "fast_break_att" => 0,
"offensive_rating" => 128.304656155027, "offensive_rebounds" => 0,
"second_chance_pct" => 100.0, "true_shooting_att" => 2.0,
"two_points_pct" => 100.0, "points_in_paint" => 2,
"assists_turnover_ratio" => 0, "steals_pct" => 0.0,
"rebounds_pct" => 8.12641083521444, "field_goals_made" => 1,
"periods" => [%{"efficiency" => 0, ...}, %{...}, ...],
"offensive_fouls" => 0, "free_throws_pct" => 0.0, ...}},
%{"active" => true, "first_name" => "Boban",
"full_name" => "Boban Marjanovic",
"id" => "24c17409-ac10-4859-be6c-59d6cc6b5810", "jersey_number" => "51",
"last_name" => "Marjanovic", "position" => "C",
"primary_position" => "C", "reference" => "1626246",
"statistics" => %{"efficiency" => 0, "triple_double" => false,
"second_chance_att" => 0, "points" => 0, "minus" => 0,
"points_in_paint_att" => 0, "blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 0.0, "points_off_turnovers" => 0,
"two_points_att" => 0, "flagrant_fouls" => 0, "steals" => 0,
"fast_break_att" => 0, "offensive_rebounds" => 0,
"second_chance_pct" => 0.0, "true_shooting_att" => 0.0,
"two_points_pct" => 0.0, "points_in_paint" => 0,
"assists_turnover_ratio" => 0, "steals_pct" => 0.0,
"rebounds_pct" => 0.0, "field_goals_made" => 0,
"periods" => [%{"efficiency" => 0, "number" => 1,
"second_chance_att" => 0, ...},
%{"efficiency" => 0, "number" => 2, ...}, %{"efficiency" => 0, ...},
%{"efficiency" => 0, ...}], "offensive_fouls" => 0,
"free_throws_pct" => 0.0, "points_in_paint_made" => 0,
"second_chance_pts" => 0, ...}},
%{"first_name" => "Dwight", "full_name" => "Dwight Buycks",
"id" => "14d86dbd-5e05-4a2e-951b-96d4e1e2e8f1", "jersey_number" => "20",
"last_name" => "Buycks", "position" => "G", "primary_position" => "PG",
"reference" => "202779",
"statistics" => %{"efficiency" => 0, "triple_double" => false,
"second_chance_att" => 0, "points" => 0, "minus" => 0,
"points_in_paint_att" => 0, "blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 0.0, "points_off_turnovers" => 0,
"two_points_att" => 0, "flagrant_fouls" => 0, "steals" => 0,
"fast_break_att" => 0, "offensive_rebounds" => 0,
"second_chance_pct" => 0.0, "true_shooting_att" => 0.0,
"two_points_pct" => 0.0, "points_in_paint" => 0,
"assists_turnover_ratio" => 0, "steals_pct" => 0.0,
"rebounds_pct" => 0.0, "field_goals_made" => 0,
"periods" => [%{"efficiency" => 0, "number" => 1,
"second_chance_att" => 0, ...},
%{"efficiency" => 0, "number" => 2, ...}, %{"efficiency" => 0, ...},
%{"efficiency" => 0, ...}], "offensive_fouls" => 0,
"free_throws_pct" => 0.0, "points_in_paint_made" => 0,
"second_chance_pts" => 0, ...}},
%{"active" => true, "first_name" => "Avery",
"full_name" => "Avery Bradley",
"id" => "b23917d2-bb0d-49fa-a384-80d994561d0c", "jersey_number" => "22",
"last_name" => "Bradley", "played" => true, "position" => "G",
"primary_position" => "SG", "reference" => "202340", "starter" => true,
"statistics" => %{"efficiency" => 12, "triple_double" => false,
"defensive_rating" => 105.701631730746, "second_chance_att" => 2,
"points" => 18, "minus" => 56, "points_in_paint_att" => 10,
"blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 4.60962258715068,
"points_off_turnovers" => 0, "two_points_att" => 13,
"flagrant_fouls" => 0, "steals" => 1, "fast_break_att" => 3,
"offensive_rating" => 122.024148849322, "offensive_rebounds" => 0,
"second_chance_pct" => 50.0, "true_shooting_att" => 15.88,
"two_points_pct" => 38.5, "points_in_paint" => 8,
"assists_turnover_ratio" => 3.0, "steals_pct" => 1.96604637903408,
"rebounds_pct" => 2.24719101123596, ...}},
%{"first_name" => "Jon", "full_name" => "Jon Leuer",
"id" => "ee9ddf70-f50d-49b0-846c-f83719b095d8", "jersey_number" => "30",
"last_name" => "Leuer", "position" => "F", "primary_position" => "PF",
"reference" => "202720",
"statistics" => %{"efficiency" => 0, "triple_double" => false,
"second_chance_att" => 0, "points" => 0, "minus" => 0,
"points_in_paint_att" => 0, "blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 0.0, "points_off_turnovers" => 0,
"two_points_att" => 0, "flagrant_fouls" => 0, "steals" => 0,
"fast_break_att" => 0, "offensive_rebounds" => 0,
"second_chance_pct" => 0.0, "true_shooting_att" => 0.0,
"two_points_pct" => 0.0, "points_in_paint" => 0,
"assists_turnover_ratio" => 0, "steals_pct" => 0.0,
"rebounds_pct" => 0.0, "field_goals_made" => 0,
"periods" => [%{"efficiency" => 0, ...}, %{...}, ...],
"offensive_fouls" => 0, "free_throws_pct" => 0.0, ...}},
%{"active" => true, "first_name" => "Andre",
"full_name" => "Andre Drummond",
"id" => "440b769d-2b8b-477f-80d7-cb21d83c0d52", "jersey_number" => "0",
"last_name" => "Drummond", "played" => true, "position" => "C",
"primary_position" => "C", "reference" => "203083", "starter" => true,
"statistics" => %{"efficiency" => 35, "triple_double" => false,
"defensive_rating" => 90.4494098612691, "second_chance_att" => 4,
"points" => 12, "minus" => 72, "points_in_paint_att" => 11,
"blocks" => 2, "double_double" => true,
"defensive_rebounds_pct" => 46.3954893274265,
"points_off_turnovers" => 2, "two_points_att" => 11,
"flagrant_fouls" => 0, "steals" => 2, "fast_break_att" => 0,
"offensive_rating" => 119.432386646934, "offensive_rebounds" => 7,
"second_chance_pct" => 25.0, "true_shooting_att" => 12.76,
"two_points_pct" => 36.4, "points_in_paint" => 8,
"assists_turnover_ratio" => 2.67, ...}},
%{"active" => true, "first_name" => "Anthony",
"full_name" => "Anthony Tolliver",
"id" => "33a91bda-9f4d-4f80-97d8-9bc574f6afc2", "jersey_number" => "43",
"last_name" => "Tolliver", "played" => true, "position" => "F",
"primary_position" => "PF", "reference" => "201229",
"statistics" => %{"efficiency" => 2, "triple_double" => false,
"defensive_rating" => 108.985437894358, "second_chance_att" => 0,
"points" => 6, "minus" => 27, "points_in_paint_att" => 1,
"blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 8.1595255235908,
"points_off_turnovers" => 0, "two_points_att" => 1,
"flagrant_fouls" => 0, "steals" => 0, "fast_break_att" => 0,
"offensive_rating" => 87.2688729807194, "offensive_rebounds" => 1,
"second_chance_pct" => 0.0, "true_shooting_att" => 5.0,
"two_points_pct" => 0.0, "points_in_paint" => 0,
"assists_turnover_ratio" => 0.0, ...}},
%{"active" => true, "first_name" => "Langston",
"full_name" => "Langston Galloway",
"id" => "138f5c1f-b8e6-4e7c-b8ef-ecb7faa7b936", "jersey_number" => "9",
"last_name" => "Galloway", "played" => true, "position" => "G",
"primary_position" => "PG", "reference" => "204038",
"statistics" => %{"efficiency" => 16, "triple_double" => false,
"defensive_rating" => 97.5742878357504, "second_chance_att" => 2,
"points" => 17, "minus" => 30, "points_in_paint_att" => 0,
"blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 11.3872249570014,
"points_off_turnovers" => 8, "two_points_att" => 2,
"flagrant_fouls" => 0, "steals" => 2, "fast_break_att" => 3,
"offensive_rating" => 149.110748320568, "offensive_rebounds" => 1,
"second_chance_pct" => 50.0, "true_shooting_att" => 11.0,
"two_points_pct" => 50.0, "points_in_paint" => 0, ...}},
%{"active" => true, "first_name" => "Luke", "full_name" => "Luke Kennard",
"id" => "a537047d-c29f-4dfe-99b0-3bac4e258dc7", "jersey_number" => "5",
"last_name" => "Kennard", "played" => true, "position" => "G",
"primary_position" => "SG", "reference" => "1628379",
"statistics" => %{"efficiency" => 1, "triple_double" => false,
"defensive_rating" => 93.8002338872659, "second_chance_att" => 2,
"points" => 4, "minus" => 29, "points_in_paint_att" => 1,
"blocks" => 1, "double_double" => false,
"defensive_rebounds_pct" => 6.39360639360639,
"points_off_turnovers" => 4, "two_points_att" => 4,
"flagrant_fouls" => 0, "steals" => 2, "fast_break_att" => 2,
"offensive_rating" => 61.1978132880953, "offensive_rebounds" => 1,
"second_chance_pct" => 50.0, "true_shooting_att" => 8.88,
"two_points_pct" => 25.0, ...}},
%{"active" => true, "first_name" => "Ish", "full_name" => "Ish Smith",
"id" => "05a90cd6-73de-43d5-9d30-bc2588d03262", "jersey_number" => "14",
"last_name" => "Smith", "played" => true, "position" => "G",
"primary_position" => "PG", "reference" => "202397",
"statistics" => %{"efficiency" => -3, "triple_double" => false,
"defensive_rating" => 105.148783281487, "second_chance_att" => 0,
"points" => 4, "minus" => 19, "points_in_paint_att" => 3,
"blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 11.988011988012,
"points_off_turnovers" => 0, "two_points_att" => 5,
"flagrant_fouls" => 0, "steals" => 0, "fast_break_att" => 1,
"offensive_rating" => 79.5442808328467, "offensive_rebounds" => 0,
"second_chance_pct" => 0.0, "true_shooting_att" => 5.0, ...}},
%{"active" => true, "first_name" => "Tobias",
"full_name" => "Tobias Harris",
"id" => "82f09975-6a8d-42e4-b42c-a52b9349ed50", "jersey_number" => "34",
"last_name" => "Harris", "played" => true, "position" => "F",
"primary_position" => "PF", "reference" => "202699", "starter" => true,
"statistics" => %{"efficiency" => 20, "triple_double" => false,
"defensive_rating" => 103.725507249097, "second_chance_att" => 1,
"points" => 19, "minus" => 59, "points_in_paint_att" => 3,
"blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 15.91537661625,
"points_off_turnovers" => 2, "two_points_att" => 8,
"flagrant_fouls" => 0, "steals" => 1, "fast_break_att" => 0,
"offensive_rating" => 151.395288813852, "offensive_rebounds" => 0,
...}},
%{"active" => true, "first_name" => "Eric", "full_name" => "Eric Moreland",
"id" => "e54fcd7e-82d0-4599-9d64-ac14532f0cde", "jersey_number" => "24",
"last_name" => "Moreland", "played" => true, "position" => "F-C",
"primary_position" => "PF", "reference" => "203961",
"statistics" => %{"efficiency" => 9, "triple_double" => false,
"defensive_rating" => 92.9346584762599, "second_chance_att" => 1,
"points" => 0, "minus" => 17, "points_in_paint_att" => 2,
"blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 55.8286525605163,
"points_off_turnovers" => 0, "two_points_att" => 2,
"flagrant_fouls" => 0, "steals" => 1, "fast_break_att" => 0,
"offensive_rating" => 85.0907292301888, "offensive_rebounds" => 4,
...}},
%{"active" => true, "first_name" => "Reggie",
"full_name" => "Reggie Bullock",
"id" => "42fa4c2c-6520-4d04-a753-cfe4a5c5e2e1", "jersey_number" => "25",
"last_name" => "Bullock", "played" => true, "position" => "F",
"primary_position" => "SF", "reference" => "203493", "starter" => true,
"statistics" => %{"efficiency" => 6, "triple_double" => false,
"defensive_rating" => 104.77107348445, "second_chance_att" => 3,
"points" => 10, "minus" => 49, "points_in_paint_att" => 4,
"blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 5.14933887316374,
"points_off_turnovers" => 3, "two_points_att" => 4,
"flagrant_fouls" => 0, "steals" => 1, "fast_break_att" => 0, ...}},
%{"active" => true, "first_name" => "Henry",
"full_name" => "Henry Ellenson",
"id" => "eef64529-e381-43d1-a72b-8dcde914fee9", "jersey_number" => "8",
"last_name" => "Ellenson", "played" => true, "position" => "F",
"primary_position" => "PF", "reference" => "1627740",
"statistics" => %{"efficiency" => 2, "triple_double" => false,
"defensive_rating" => 110.995584750072, "second_chance_att" => 1,
"points" => 2, "minus" => 5, "points_in_paint_att" => 0, "blocks" => 0,
"double_double" => false, "defensive_rebounds_pct" => 0.0,
"points_off_turnovers" => 0, "two_points_att" => 1,
"flagrant_fouls" => 0, "steals" => 0, "fast_break_att" => 0,
"offensive_rating" => 200.0, ...}}], "points" => 105,
"reference" => "1610612765",
"scoring" => [%{"number" => 1, "points" => 30, "sequence" => 1,
"type" => "quarter"},
%{"number" => 2, "points" => 29, "sequence" => 2, "type" => "quarter"},
%{"number" => 3, "points" => 26, "sequence" => 3, "type" => "quarter"},
%{"number" => 4, "points" => 20, "sequence" => 4, "type" => "quarter"}],
"statistics" => %{"efficiency" => 106,
"defensive_rating" => 99.5188101487314, "second_chance_att" => 17,
"points" => 105, "team_tech_fouls" => 0, "team_offensive_rebounds" => 8,
"points_in_paint_att" => 43, "blocks" => 3, "bench_points" => 35,
"points_off_turnovers" => 22, "player_tech_fouls" => 1,
"two_points_att" => 60, "flagrant_fouls" => 0, "steals" => 10,
"fast_break_att" => 10, "offensive_rating" => 109.05691732447,
"offensive_rebounds" => 14, "second_chance_pct" => 47.1,
"possessions" => 96.28, "true_shooting_att" => 95.28,
"biggest_lead" => 24, "two_points_pct" => 46.7, "points_in_paint" => 38,
"total_fouls" => 23, "assists_turnover_ratio" => 1.73, "ejections" => 0,
"field_goals_made" => 41,
"periods" => [%{"efficiency" => 28, "number" => 1,
"defensive_rating" => 128.737541528239, "second_chance_att" => 5,
"points" => 30, "team_tech_fouls" => 0, "team_offensive_rebounds" => 2,
"points_in_paint_att" => 12, "blocks" => 2, ...},
%{"efficiency" => 35, "number" => 2,
"defensive_rating" => 68.5557586837294, "second_chance_att" => 5,
"points" => 29, "team_tech_fouls" => 0, "team_offensive_rebounds" => 3,
"points_in_paint_att" => 14, ...},
%{"efficiency" => 29, "number" => 3,
"defensive_rating" => 77.9896013864818, "second_chance_att" => 2,
"points" => 26, "team_tech_fouls" => 0, "team_offensive_rebounds" => 3,
...},
%{"efficiency" => 14, "number" => 4,
"defensive_rating" => 120.535714285714, "second_chance_att" => 5,
"points" => 20, "team_tech_fouls" => 0, "team_offensive_rebounds" => 0,
...}], "offensive_fouls" => 1, "free_throws_pct" => 83.3,
"offensive_points_per_possession" => 1.09, "total_rebounds" => 57,
"points_in_paint_made" => 19, "second_chance_pts" => 18,
"true_shooting_pct" => 55.1, "free_throws_made" => 10,
"three_points_pct" => 43.3, "rebounds" => 46, ...}}, "clock" => "00:00",
"coverage" => "full", "duration" => "2:06", "entry_mode" => "WEBSOCKET",
"home" => %{"alias" => "ATL", "bonus" => true,
"coaches" => [%{"first_name" => "Ben", "full_name" => "Ben Sullivan",
"last_name" => "Sullivan", "position" => "Assistant Coach",
"reference" => "204224"},
%{"first_name" => "Scottie", "full_name" => "Scottie Parker",
"last_name" => "Parker", "position" => "Trainer",
"reference" => "1628764"},
%{"first_name" => "Pat", "full_name" => "Pat St. Andrews",
"last_name" => "St. Andrews", "position" => "Assistant Coach",
"reference" => "1628784"},
%{"first_name" => "Darvin", "full_name" => "Darvin Ham",
"last_name" => "Ham", "position" => "Assistant Coach",
"reference" => "203005"},
%{"first_name" => "Mike", "full_name" => "Mike Budenholzer",
"id" => "6c9c23f1-d87d-4aca-8414-3d86b0b3993e",
"last_name" => "Budenholzer", "position" => "Head Coach",
"reference" => "1371"},
%{"first_name" => "Chris", "full_name" => "Chris Jent",
"last_name" => "Jent", "position" => "Assistant Coach",
"reference" => "2607"},
%{"first_name" => "Wally", "full_name" => "Wally Blase",
"last_name" => "Blase", "position" => "Trainer", "reference" => "2150"},
%{"first_name" => "Taylor", "full_name" => "Taylor Jenkins",
"last_name" => "Jenkins", "position" => "Assistant Coach",
"reference" => "203624"},
%{"first_name" => "Charles", "full_name" => "Charles Lee",
"last_name" => "Lee", "position" => "Assistant Coach",
"reference" => "204225"}],
"id" => "583ecb8f-fb46-11e1-82cb-f4ce4684ea4c", "market" => "Atlanta",
"name" => "Hawks",
"players" => [%{"first_name" => "Mike", "full_name" => "Mike Muscala",
"id" => "7c636961-816a-4b44-8991-671df9d91d9c", "jersey_number" => "31",
"last_name" => "Muscala", "position" => "F-C",
"primary_position" => "PF", "reference" => "203488",
"statistics" => %{"efficiency" => 0, "triple_double" => false,
"second_chance_att" => 0, "points" => 0, "minus" => 0,
"points_in_paint_att" => 0, "blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 0.0, "points_off_turnovers" => 0,
"two_points_att" => 0, "flagrant_fouls" => 0, "steals" => 0,
"fast_break_att" => 0, "offensive_rebounds" => 0,
"second_chance_pct" => 0.0, "true_shooting_att" => 0.0,
"two_points_pct" => 0.0, "points_in_paint" => 0,
"assists_turnover_ratio" => 0, "steals_pct" => 0.0,
"rebounds_pct" => 0.0, "field_goals_made" => 0,
"periods" => [%{"efficiency" => 0, "number" => 1, ...},
%{"efficiency" => 0, ...}, %{...}, ...], "offensive_fouls" => 0,
"free_throws_pct" => 0.0, "points_in_paint_made" => 0, ...}},
%{"active" => true, "first_name" => "Kent", "full_name" => "Kent Bazemore",
"id" => "2c157857-fffd-4eb5-8e2a-b28ebea8da77", "jersey_number" => "24",
"last_name" => "Bazemore", "played" => true, "position" => "G",
"primary_position" => "SG", "reference" => "203145", "starter" => true,
"statistics" => %{"efficiency" => 8, "triple_double" => false,
"defensive_rating" => 106.069502377609, "second_chance_att" => 1,
"points" => 8, "minus" => 50, "points_in_paint_att" => 3,
"blocks" => 3, "double_double" => false,
"defensive_rebounds_pct" => 20.1416207710464,
"points_off_turnovers" => 0, "two_points_att" => 4,
"flagrant_fouls" => 0, "steals" => 0, "fast_break_att" => 0,
"offensive_rating" => 82.2342730948014, "offensive_rebounds" => 1,
"second_chance_pct" => 0.0, "true_shooting_att" => 10.88,
"two_points_pct" => 0.0, "points_in_paint" => 0,
"assists_turnover_ratio" => 2.0, "steals_pct" => 0.0, ...}},
%{"active" => true, "first_name" => "Luke", "full_name" => "Luke Babbitt",
"id" => "d8298a51-2639-422a-869b-61c6fe27afd1", "jersey_number" => "8",
"last_name" => "Babbitt", "played" => true, "position" => "F",
"primary_position" => "SF", "reference" => "202337",
"statistics" => %{"efficiency" => 10, "triple_double" => false,
"defensive_rating" => 112.231151758584, "second_chance_att" => 0,
"points" => 7, "minus" => 41, "points_in_paint_att" => 0,
"blocks" => 0, "double_double" => false,
"defensive_rebounds_pct" => 20.0888186193587,
"points_off_turnovers" => 0, "two_points_att" => 1,
"flagrant_fouls" => 0, "steals" => 0, "fast_break_att" => 0,
"offensive_rating" => 135.261953010297, "offensive_rebounds" => 0,
"second_chance_pct" => 0.0, "true_shooting_att" => 5.76,
"two_points_pct" => 0.0, "points_in_paint" => 0,
"assists_turnover_ratio" => 0, "steals_pct" => 0.0, ...}},
%{"active" => true, "first_name" => "DeAndre'",
"full_name" => "DeAndre' Bembry",
"id" => "db42a3d8-e493-4f0e-aa9f-149397877fea", "jersey_number" => "95",
"last_name" => "Bembry", "played" => true, "position" => "F-G",
"primary_position" => "SF", "reference" => "1627761",
"statistics" => %{"efficiency" => -5, "triple_double" => false,
"defensive_rating" => 119.305763024204, "second_chance_att" => 0,
"points" => 0, "minus" => 40, "points_in_paint_att" => 2,
"blocks" => 1, "double_double" => false,
"defensive_rebounds_pct" => 0.0, "points_off_turnovers" => 0,
"two_points_att" => 2, "flagrant_fouls" => 0, "steals" => 0,
"fast_break_att" => 0, "offensive_rating" => 15.8695381624177,
"offensive_rebounds" => 0, "second_chance_pct" => 0.0,
"true_shooting_att" => 3.0, "two_points_pct" => 0.0,
"points_in_paint" => 0, "assists_turnover_ratio" => 0.5, ...}},
Hopefully showing the map might help you understand what I'm trying to accomplish.
players is a list.
Map.take(game, ["away", "home"]) should definitely work, but Kernel.get_in/2 and using Access behaviour is way more idiomatic.
Everything you need is to intersperse Kernel.get_in/2 with Enum.find/2 for lookup:
game
|> get_in(~w|away players|)
|> Enum.find(fn e -> CONDITION end)
|> get_in(~w|statistics points|)
If you were to post MCVE instead of non-valid object, I could be able to test this.

PHP error getimagesize failed to open stream: Connection refused

I am using FPDF.php. I get an error when I try to create a PDF "FPDF error: Missing or incorrect image file: http://www.example.com/wp-content/uploads/2015/05/image.jpg"
In my error log I get this error:
PHP Warning: getimagesize(http://www.example.com/wp-content/uploads/2015/05/image.jpg): failed to open stream: Connection refused in /home/cluster-sites/2639/c/example.com/public_html/wp-content/themes/nameoftheme/includes/fpdf/fpdf.php on line 1213
I have set allow_url_fopen = ON in php.ini
I think it has something to do with the image path but I'm not sure what. It works fine on my test server.
My code is as follows:
//check if the query_string contains an ID
if(!isset($_REQUEST['id']))
{
header('Location:'.site_url());
exit();
}
//check if the ID is related to a WP_Post
$post = get_post($_REQUEST['id']);
if(empty($post))
{
header('Location:'.site_url());
exit();
}
//creating the brochure directory if not exists
if(!is_dir(ABSPATH.'wp-content/uploads/brochure'))
mkdir(ABSPATH.'wp-content/uploads/brochure');
$pdf_path = ABSPATH.'wp-content/uploads/brochure/'.$post->post_name.'.pdf';
$cache = false;
$debug = false;
//generating the pdf if not exists or older than the latest post update
if(!$cache || !is_file($pdf_path) || strtotime($post->post_modified) > filemtime($pdf_path))
{
require(get_template_directory().'/includes/fpdf/fpdf_enhanced.php');
global $imic_options;
$image_size = '600-400-size';
$pdf = new PDF_enhanced();
$pdf->AddFont('opensans','','opensans.php');
$pdf->AddFont('opensans','b','opensansb.php');
$pdf->AddFont('opensans','i','opensansi.php');
//$pdf->AddFont('opensans','eb','opensanseb.php');
//$pdf->AddFont('opensans','ebi','opensansebi.php');
$pdf->AddFont('opensans','l','opensansl.php');
//$pdf->AddFont('opensans','li','opensansli.php');
//$pdf->AddFont('opensans','s','opensanss.php');
//$pdf->AddFont('opensans','si','opensanssi.php');
$pdf->SetMargins(0, 0);
$property_sights = get_post_meta($post->ID, 'imic_property_sights', false);
//---------------------------------first page
$pdf->AddPage();
//main picture
$featured_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), $image_size);
if(!empty($featured_image_url))
$pdf->Image($featured_image_url[0], 0, 0, 210, 0);
else if(!empty($property_sights))
{
$image = wp_get_attachment_image_src(array_shift($property_sights), $image_size);
$pdf->Image($image[0], 0, 0, 210, 0);
}
//left border
$pdf->SetFillColor(183, 132, 36);
$pdf->Rect(0, 0, 1.2, 297, 'F');
//property title
$pdf->SetFont('opensans', '', 30);
$pdf->SetTextColor(97, 33, 114);
$pdf->SetXY(20, 150);
$pdf->MultiCell(175, 12, $post->post_title, $debug);
//property address
$address = get_post_meta($post->ID, 'imic_property_site_address', true);
$pdf->SetFont('opensans', 'i', 20);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(20, 175);
$pdf->Cell(100, 12, $address, $debug);
//property price
$pdf->SetFont('opensans', 'b', 16);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(120, 180);
$pdf->MultiCell(60, 12, html_entity_decode(imic_get_currency_symbol($imic_options['currency-select'])).number_format(get_post_meta($post->ID, 'imic_property_price', true)), $debug, 'R');
//property number beds
$beds = get_post_meta($post->ID, 'imic_property_beds', true);
$pdf->SetFont('opensans', 'b', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(20, 200);
$pdf->Cell(30, 5.5, 'Number beds: ', $debug, 'L');
$pdf->SetFont('opensans', 'l', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(50, 200);
$pdf->Cell(20, 5.5, html_entity_decode($beds), $debug, 'L');
//property number of baths
$baths = get_post_meta($post->ID, 'imic_property_baths', true);
$pdf->SetFont('opensans', 'b', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(20, 208);
$pdf->Cell(36, 5.5, 'Number of baths: ', $debug, 'L');
$pdf->SetFont('opensans', 'l', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(56, 208);
$pdf->Cell(20, 5.5, html_entity_decode($baths), $debug, 'L');
//property floor area
$area = get_post_meta($post->ID, 'imic_property_area', true);
$pdf->SetFont('opensans', 'b', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(20, 216);
$pdf->Cell(23, 5.5, 'Floor area: ', $debug, 'L');
$pdf->SetFont('opensans', 'l', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(43, 216);
$pdf->Cell(20, 5.5, html_entity_decode($area.' Sq Ft'), $debug, 'L');
//property beachfront
$beachfront = get_post_meta($post->ID, 'imic_property_beachfront', true);
$pdf->SetFont('opensans', 'b', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(20, 224);
$pdf->Cell(25, 5.5, 'Beachfront: ', $debug, 'L');
$pdf->SetFont('opensans', 'l', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(45, 224);
$pdf->Cell(20, 5.5, html_entity_decode($beachfront), $debug, 'L');
//property freehold
$pdf->SetFont('opensans', 'b', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(20, 232);
$pdf->Cell(20, 5.5, 'Freehold: ', $debug, 'L');
$pdf->SetFont('opensans', 'l', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(40, 232);
$pdf->Cell(20, 5.5, 'Yes', $debug, 'L');
//property close to
$closeto = implode(', ', get_post_meta($post->ID, 'imic_property_closeto', true));
$pdf->SetFont('opensans', 'b', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(20, 240);
$pdf->Cell(19, 5.5, 'Close to: ', $debug, 'L');
$pdf->SetFont('opensans', 'l', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(39, 240);
$pdf->MultiCell(150, 5.5, html_entity_decode($closeto), $debug, 'L');
//logo
$pdf->Image($imic_options['logo_upload']['url'], 150, 270, 45, 0);
//---------------------------------second page
$pdf->AddPage();
//second page main picture
if(!empty($property_sights))
{
$image = wp_get_attachment_image_src(array_shift($property_sights), $image_size);
$pdf->Image($image[0], 0, 0, 210, 0);
}
//save the next image for the third page
$third_page_image = false;
if(!empty($property_sights))
$third_page_image =array_shift($property_sights);
$height = 142;
//thumbnails
if(!empty($property_sights))
{
$height += 58;
$image = wp_get_attachment_image_src(array_shift($property_sights), $image_size);
$pdf->Image($image[0], 0, 142, 69, 0);
if(!empty($property_sights))
{
$image = wp_get_attachment_image_src(array_shift($property_sights), $image_size);
$pdf->Image($image[0], 71, 142, 69, 0);
}
if(!empty($property_sights))
{
$image = wp_get_attachment_image_src(array_shift($property_sights), $image_size);
$pdf->Image($image[0], 142, 142, 69, 0);
}
}
else
$height += 10;
//property title
$pdf->SetFont('opensans', '', 15);
$pdf->SetTextColor(97, 33, 114);
$pdf->SetXY(20, $height);
$pdf->MultiCell(180, 12, $post->post_title, $debug);
//property address
$address = get_post_meta($post->ID, 'imic_property_site_address', true);
$pdf->SetFont('opensans', 'i', 15);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(20, $height + 10);
$pdf->Cell(200, 12, $address, $debug, 'L');
//property features
$height += 25;
$pdf->SetFont('opensans', 'i', 10);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(25, $height);
$pdf->Cell(100, 2, 'Features: ', $debug);
$property_amenities = get_post_meta($post->ID, 'imic_property_amenities', true);
foreach($property_amenities as $properties_amenity)
{
if($properties_amenity != 'Not Selected')
{
$pdf->SetFillColor(102, 102, 102);
$pdf->SetFont('opensans', 'l', 10);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(25, $height);
$pdf->Cell(100, 12, $properties_amenity, $debug);
$height += 5;
}
}
//---------------------------------third page
$pdf->AddPage();
//second page main picture
if(!empty($third_page_image))
{
$image = wp_get_attachment_image_src($third_page_image, $image_size);
$pdf->Image($image[0], 0, 0, 210, 0);
}
//rest of description
$description = $post->post_content;
$description = preg_replace("/(\r?\n){2,}/", "\n", $description);
$description = str_replace('’', '\'', $description);
$description = apply_filters( '$description', $post->post_content );
if(strlen($description) > 900)
$description = substr($description, 0, strpos($description, '.', 900)).'.';
$pdf->SetFont('opensans', 'l', 11);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(20, 145);
$pdf->MultiCell(170, 5.5, iconv("UTF-8", "CP1250//TRANSLIT", $description), $debug, 'L');
//separator
$pdf->SetFillColor(183, 132, 36);
$pdf->Rect(20, 234, 170, 0.7, 'F');
//contact title
$pdf->SetFont('opensans', 'i', 12);
$pdf->SetTextColor(183, 132, 36);
$pdf->SetXY(19, 234);
$pdf->Cell(20, 10, 'Example Name', $debug);
//contact details
$contact = "Building\n1st Street W.I.\ninfo#example.com\n+(1) 246 432 4663\nexample.com";
$pdf->SetFont('opensans', 'l', 9);
$pdf->SetTextColor(102, 102, 102);
$pdf->SetXY(19, 244);
$pdf->MultiCell(100, 4, $contact, $debug);
//---------------------------------fourth page
//save pdf
$pdf->Output($pdf_path);
}
//last check if the pdf exists
if(is_file($pdf_path))
{
//display pdf
header('Content-type: application/pdf');
readfile($pdf_path);
}
else
{
header('Location:'.site_url());
exit();
}
?>

graphaeljs error

I am using the graphaeljs library to display charts, at an ASP.NET MVC 4
I have copied this code from the graphaeljs website
<script src="scripts/raphael.js"></script>
<script src="scripts/g.raphael-min.js"></script>
<script src="scripts/g.bar-min.js"></script>
<script>
window.onload = function () {
var r = Raphael("holder"),
fin = function () {
this.flag = r.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this);
},
fout = function () {
this.flag.animate({ opacity: 0 }, 300, function () { this.remove(); });
},
fin2 = function () {
var y = [], res = [];
for (var i = this.bars.length; i--;) {
y.push(this.bars[i].y);
res.push(this.bars[i].value || "0");
}
this.flag = r.popup(this.bars[0].x, Math.min.apply(Math, y), res.join(", ")).insertBefore(this);
},
fout2 = function () {
this.flag.animate({ opacity: 0 }, 300, function () { this.remove(); });
},
txtattr = { font: "12px sans-serif" };
r.text(160, 10, "Single Series Chart").attr(txtattr);
r.text(480, 10, "Multiline Series Stacked Chart").attr(txtattr);
r.text(160, 250, "Multiple Series Chart").attr(txtattr);
r.text(480, 250, "Multiline Series Stacked Chart\nColumn Hover").attr(txtattr);
r.barchart(10, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10]]).hover(fin, fout);
r.hbarchart(330, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]], { stacked: true }).hover(fin, fout);
r.hbarchart(10, 250, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]]).hover(fin, fout);
var c = r.barchart(330, 250, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]], { stacked: true, type: "soft" }).hoverColumn(fin2, fout2);
};
</script>
But when I run at my browser, this message appears
Uncaught TypeError: Cannot read property 'x' of undefined raphael.js:11
c._engine.create raphael.js:11
c raphael.js:9
window.onload (index):92
I do not know what I do wrong, and I used the libraries exactly as they are. Can you please tell me, what might be my mistake?
Sorry, I don't see anything wrong with the code you posted.
I made a fiddle for you.
It is obviously an issue with the raphael.js file.
Be sure to include class="raphael" on your body tag, and a div with id="holder".
If that fails, try re-downloading raphael.js.

Resources