w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
apply d3.nest rollup to nested pie chart (to vary the size of the pies)
Create an object w/ each origin's total flights: var totalFlights = {}; airports.forEach(function(d){ totalFlights[d.key] = d3.sum(d.values.map(function(d){ return +d.count; })); }); Size the arcs based on their origin's total flights: var arc = d3.svg.arc() .innerRadius(function(d){ return totalFlights[d.data.origin]/952 * r / 2; }) .outerRadius(function(d){ return totalFlights[d.data.origin]/952 * r; }); 952 is a bit of a magic number here, set equal to the max number of flights from an airport. Ideally, you'd use a scale instead. Working example: http://bl.ocks.org/1wheel/6471631

Categories : Javascript

Return multiple values from a crossfilter dimension for a pie chart
Not an expert, but I think you need to use .reduce() in the group and create your own reduceAdd, reduceRemove and reduceInitial functions. .groupAll().reduce(reduceAdd, reduceRemove, reduceInitial).value(); Like explained here except it's for a pie chart, not a barchart.

Categories : Javascript

SQL Query for Access Pie chart - Group By one field but group certain values
Try this and don't forget to vote ;) select count(*), case when Status in ( 'sent', 'monitoringStage1', 'monitoringStage2', 'finalApproval') then 'pending' else status end as status from StatusTable group by case when Status in ( 'sent', 'monitoringStage1', 'monitoringStage2', 'finalApproval') then 'pending' else status end

Categories : SQL

Select multiple columns in current region to create bar chart using Excel VBA
Instead of this: Source.Worksheets("Sheet1").Range(Search.Address).Offset(2, 0). _ CurrentRegion.Activate Use this, which contracts the selected area so as to exclude the last row and last column of the data table: Dim tbl As Range Set tbl = Source.Worksheets("Sheet1").Range(Search.Address).Offset(2, 0). _ CurrentRegion tbl.Resize(tbl.Rows.Count - 1, tbl.Columns.Count - 1).Select While continuing to comment out or delete: 'ActiveChart.SetSourceData Source:=ActiveWorkbook.Sheets(1). _ Range(Search.Address).Offset(2,0).CurrentRegion. _ Resize(CR.Rows.Count - 1, CR.Columns.Count)

Categories : Excel

MySQL query group by with multiple sum values
If you just want the two columns, it's fairly easy to do; SELECT Year, SUM(CASE WHEN Type='A' THEN Amt ELSE 0 END) TypeA, SUM(CASE WHEN Type='B' THEN Amt ELSE 0 END) TypeB FROM YourTable GROUP BY Year An SQLfiddle to test with. ...or a bit more verbose standard SQL;

Categories : Mysql

Php parse xml (multiple nested <> ). With one nested <> works, - multiple does not work
The reason is because you are accessing the $currencies like its the root element. You could load the file and reference currencies with $xmlDoc->currencies and it should work. Please try the following: $xmlDoc = simplexml_load_file('__joomla.xml'); /**/ $cdate=$xmlDoc->Date; echo "<time>". $cdate. "</time><br>"; foreach ($xmlDoc->Currencies->Currency as $currency): $id=$currency->ID; $units=$currency->Units; $rate=$currency->Rate; echo " <div class='id'>". $id. "</div> <div class='units'>". $units. "</div> <div class='rate'>". $rate. "</div> "; endforeach; Update: Updated $xmlDoc->Currencies to $xmlDoc->Currencies->Currency, as we want to loop through the Currencies' children.

Categories : PHP

Dictionary with Multiple Values from a Nested List
This is a case for collections.defaultdict: import collections my_list = [('key1', 'topic1', 'content1'), ('key2', 'topic1', 'content2'), ('key3', 'topic2', 'content3')] my_dict = collections.defaultdict(list) for _, key, value in my_list: my_dict[key].append(value) print(my_dict) Gives us: defaultdict(<class 'list'>, {'topic2': ['content3'], 'topic1': ['content1', 'content2']}) The defaultdict creates the list for the values if it doesn't exist, meaning we can do this really easily by just looping over the list and appending the values to the key. It acts exactly as a normal dictionary in every other way, but if you need a normal dict, you can just use dict() on it.

Categories : Python

how to read values from JSON nested in multiple arrays
use the following code: for(var i = 0; i < listEditions.length; i++) { var arrayItem=item.listEditions[i].listInsertion; //get colorType value alert(arrayItem[0].colorType); //get color value alert(arrayItem[0].color) } i think it will meet your demand.you can see the example:http://jsfiddle.net/rayhan/x2H5W/

Categories : Java

How to seperate multiple select box values based on category and display as group?
You can use grouped_collection_select helper from ActionView::Helpers::FormOptionsHelper.

Categories : Ruby On Rails

Codeigniter - Insert multiple values from a nested array in database
You should read Insert array into MySQL database with PHP before. An advice: To make what you wish, search for MongoDB.

Categories : PHP

Find JSON nested nodes using multiple string values
Have you tried $.grep()? var test = $.grep(pricing.activities, function(e){ return e.activitycode == 'TK'; }); var test2 = $.grep(test[0].ticketTypes, function(e){ return e.ticketcode == "G";}); console.log(test2[0].baseprice); Fiddle Here. jQuery API Documentation on $.grep() here Example from this question I wouldn't say it's better than $.each(), but it's another method, if you're into that sort of thing.

Categories : Javascript

T-SQL - How to Select and Group Multiple Records (in multiple columns) for Each Employee?
You can do this: SELECT t1.First_Name, t1.Last_Name, STUFF(( SELECT ', ' + t2.Address FROM Tablename AS t2 WHERE t1.First_Name = t2.First_name AND t1.Last_Name = t2.Last_Name FOR XML PATH('')) ,1,2,'') AS Address FROM tablename AS t1 GROUP BY t1.First_Name, t1.Last_Name; This will give you the results grouped by First_name and Last_Name with the address coma separated. See it in action here: SQL Fiddle Demo This will give you: | FIRST_NAME | LAST_NAME | ADDRESS | ----------------------------------------------------- | Jim | Doe | 1111 Street, 2222 Street | | John | Smith | 5000 Street, 6666 Street |

Categories : SQL

MySQL multiple join, multiple sort maintain group
The problem with your order by is that you are including sp.party_id. The pair uniquely defines each row, so no other sort criteria are necessary. I think this will fix your problem: order by sp.suit_id, p.name, c.charge_code

Categories : PHP

Alternative to MS SQL Server's GROUP BY ... WITH ROLLUP in PostgreSQL?
If I understand your question correctly you want to know how to do the equivalent of the MS SQL Server extension WITH ROLLUP in PostgreSQL and the rest of the query appears to be irrelevant noise. If so, according to MSDN, the WITH ROLLUP option adds subtotals. This is not something PostgreSQL currently supports, unfortunately. The workaround for it in PostgreSQL is to write something like: WITH my_real_query AS ( SELECT a, b FROM ... -- blah blah ) SELECT 'line', a, b FROM my_real_query UNION ALL SELECT 'sum', sum(a), sum(b) FROM my_real_query; depending on exactly what you want to do. This requires the inner table to be materialized and then scanned twice, so it's not exactly super-efficient. If you want to group by subsets you can do that by adding a GROUP BY to the sec

Categories : Postgresql

how do you chart multiple variables as line chart using highcharts
You need parse your dates "1/2/2013 12:00:00" to JS timestamp (time in milisecods). You can use i.e. Date.UTC() function. Secondly you have to use numbers to display chart (not strings) for CPU values.

Categories : Highcharts

Create matrix from multiple values in a single cell
Starting in cell A2, paste your list of books to create the left side of your grid. Copy your list of IDs, then starting In cell B2, paste your list of ids by selecting paste special, transpose. This will create the top and side of your matrix. Paste this formula in Cell B2 =IF(ISERROR(FIND($A2,VLOOKUP(B$1,$K:$L,2,FALSE))),0,1) (WHERE $K:$L is a listing of ids, belong. i.e. The second and third columns in your sample data. These can be anywhere as long as you update the reference $K:$L to refer to the new location) Now, copy Cell B2, and paste for the rest of the matrix.

Categories : Excel

MS Chart zooming with multiple chart areas
I found out what the issue was and why all the chart areas were zooming at the same time -- I had Chart.ChartArea[i].AlignWithChartArea set to other charts to make the visuals a bit better. Apparently that binds the zooming as well for some reason.

Categories : C#

Create an Insert Parameter based off values of multiple fields - .NET
You can use javascript to manually build the name and dump it into the textbox. Just attach a handler to the blur event on the first and last name textboxes. When you post, it will be as if the user typed it in themselves. Or even better, move your data access out of your markup and put it into your actual code, and make your database calls properly using ADO.NET - this will give you the flexibility to build your commands exactly how you want them, and bind the parameters however you need.

Categories : Asp Net

Trying to find multiple values from one column and group by another column - can't seem to figure it out
I believe it's because you can't group by partial matches? You are not “grouping” by the value column, but by company_id instead, so this should not matter. having count(distinct value) = 2 I think the DISTINCT here is your problem – here partial matches could be problematic. Try having count(company_id) = 2 instead (or maybe even >= 2 if there might be more results and you still want to catch those company ids) – every row in your search table that contains a match will be selected, so counting how often each company id occurs should do the trick. Edit: OK, so the problem is if a company has two hits for mall, f.e. mall and shopping mall, but none for grocery, you don’t want to find it, but only if mall and grocery are found at least once. Well, then let’

Categories : Mysql

How to create a BIRT dataset that accepts multiple (CSV) values that it can be used inside "IN" clause in select statement
We cannot do this with a regular SQL parameter '?'. A workaround is to replace this '?' by a default value in the query, and dynamically inject an appropriate comma-separated list of values in the "beforeOpen" script of the dataset: Default query Assuming the datatype of ID is an integer, set up the query like this (of course use here a valid ID to be able to preview data): select * from table where ID in ( 1000 ) "beforeOpen" script of the dataset: this.queryText=this.queryText.replaceAll('1000',params["parameter_name"].value.join(",")); This way, if "parameter_name" returns 3 values 1100,1200,1300 the query sent to the database will be: select * from table where ID in ( 1100,1200,1300) It is similar if the datatype of ID is a String, we just have to play a little bit wit

Categories : Reporting Services

Create Multiple Lightboxs for Multiple Elements on Single Page?
You could for example specify which lightbox id the a should have by storing it in data <a href='#' data-light='1'>Lightbox 1</a> <a href='#' data-light='2'>Lightbox 2</a> <a href='#' data-light='3'>Lightbox 3</a> The you get data in your script jQuery('a').click(function(){ jQuery('#unique-lightbox-' + $(this).data('light')).fadeIn('1000'); return false; }); Or if you have all your a in one parent. You could use their index jQuery('a').click(function(){ jQuery('.lightbox:eq('+($(this).index()+1)+')').fadeIn('1000'); return false; });

Categories : Javascript

error when set multiple variable values from multiple select queries
User var_dump($_POST); to see actual name of variables. Usrname and other indexes are simply not defined in post array. Use mysqli functions in php not mysql, because they already are deprecated, and they are not to be used in the future versions of php.

Categories : PHP

Associating multiple teams with multiple headers/values:
Your code only handle th. should also handle td. Try following: from bs4 import BeautifulSoup from urllib.request import urlopen u = urlopen("http://www.nhl.com/ice/teamstats.htm") soup = BeautifulSoup(u) u.close() for table in soup.find_all('table', class_='data stats'): row = table.find('tr') header = [] for cell in row.find_all('th')[1:]: name = cell.string.strip() header.append(name) for row in table.find_all('tr')[1:]: for name, cell in zip(header, row.find_all('td')[1:]): value = cell.string.strip() print('{}: {}'.format(name, value), end=', ') print()

Categories : Python

mysql - multiple min values from multiple groups in table
Possible way to do it, but probably not efficient. SELECT country, duration, price, departure, hotelname, otherData FROM ( SELECT a.country, a.duration, a.price, a.departure, a.hotelname, a.otherData, @counter := IF(a.country = @PrevCountry, @counter + 1, 0) AS CountryCounter, @PrevCountry := a.country FROM (SELECT * FROM SomeTable ORDER BY country, duration, RAND()) a CROSS JOIN (SELECT @counter:=0, @PrevCountry:='') Sub2 ) Sub1 WHERE CountryCounter < 6 This is using a user variable to get a sequence number of each record for a country, then using that sequence number to dispose of any records after the 1st 6 for each country. Not tested.

Categories : Mysql

Multiple dropdown values inserting in a single row not in multiple row
Are there any error messages being displayed? Insert the following code just before the mysql_query statement: echo "insert into tb values('','$choice1')"; what is being displayed?

Categories : PHP

Rails - how to join/group nested tables and get joined values out?
You can make this little bit more prettier than raw sql by using rails AR querying methods: AccountGroup. select("account_groups.id, SUM(net_position), account_groups.name"). joins("LEFT JOIN accounts ON accounts.account_group_id = account_groups.id"). joins("LEFT JOIN positions ON positions.account_id = accounts.id"). group("account_groups.id,account_groups.name")

Categories : Ruby On Rails

updating multiple values from multiple table
Try this below. Also, according from your table layout you're missing the discount column, I'm assuming it's in the test database. UPDATE sales AS t1, rsales AS t2 SET t1.total = '$total_discount', t2.total = '$total_discount', t2.discount = '$tot' WHERE t1.pcode = '$pcode' AND t2.pcode = t1.pcode By the way, you're modifying all rows because of this line: WHERE rsales.sales_id IN (SELECT sales.id FROM sales) Here, you are saying to update rsales where sales_id is IN (One Of) the sales.id fields. You are pulling all sales.id's. If you need to specify what ID specifically, add this to the bottom of the query above: AND t1.id = '$id' AND t2.sales_id = t1.id Haven't made a mock up of your DB so I haven't tested it.

Categories : PHP

Searching multiple values through multiple columns
You need to build the sql statement. For example: $whr = ""; $srch1 = ( isset($_POST['suburb']) ) ? $_POST['suburb'] : ""; //-- repeat for each field if( $srch1 != "" ) $whr .= " suburb like '%'.%srch1."%'"; $sql ="SELECT ... FROM ... "; if( $whr != "" ) $sql .= " WHERE ".$whr;

Categories : PHP

SELECT multiple values to the same key in multiple tables
You should try SELECT t1.uid FROM tabl_1 t1 INNER JOIN tabl_2 t2 ON t1.uid = t2.uid AND t2.meta_key = 'location' AND t2.meta_value = 'NY' INNER JOIN tabl_2 t3 ON t1.uid = t3.uid AND t3.meta_key = 'school' AND t3.meta_value = 'NYU' Check result on http://sqlfiddle.com/#!2/f35ef/1/0

Categories : Mysql

Hashmaps having multiple keys with multiple values
Re your edit, it looks like you want to retrieve by any of the keys. So all you really have here is a String : List map. Just loop through that file, split each line on ||, and add the first entry to the first key's list, the second entry to the second key's list, etc. Very roughly, Java-like pseudocode: Map<String, List> map = HashMap<String, List>(); String line; String[] entries; int index; String[] keys; //...open file... // First line is keys line = source.readLine(); if (line == null) { // File is empty } else { // Add the keys keys = new String[entries.size()]; index = 0; for (String key : entries) { keys[index++] = key; map.put(key, new LinkedList()); } // Process entries while ((line = source.readLine()) != null)

Categories : Java

Display multiple rows and column values into a single row, multiple column values
Since you are using SQL Server there are several ways that you can transpose the rows of data into columns. Aggregate Function / CASE: You can use an aggregate function with a CASE expression along with row_number(). This version would require that you have a known number of values to become columns: select id, name, max(case when rn = 1 then employer end) employer1, max(case when rn = 1 then IncomeType end) IncomeType1, max(case when rn = 1 then Amount end) Amount1, max(case when rn = 2 then employer end) employer2, max(case when rn = 2 then IncomeType end) IncomeType2, max(case when rn = 2 then Amount end) Amount2, max(case when rn = 3 then employer end) employer3, max(case when rn = 3 then IncomeType end) IncomeType3, max(case when rn = 3 then Amount end) Amount3

Categories : SQL

YUI chart with multiple series
I ended up leaving YUI charts and going with Google Charts instead - https://developers.google.com/chart/ - which for me is a lot easier to work with.

Categories : Javascript

oracle -- Split multiple comma separated values in oracle table to multiple rows
Can use the below query to convert comma separated values in rows SELECT trim(x.column_value.extract('e/text()')) COLUMNS from t t, table (xmlsequence(xmltype('<e><e>' || replace(valuestring,':','</e><e>')|| '</e></e>').extract('e/e'))) x );

Categories : SQL

How to place multiple bar in jqplot bar chart
var s1 = [ 1, 2, 2, 3 ]; var s2 = [ 12, 32, 3, 12 ]; var s3 = [ 12, 32, 54, 64 ]; var ticks = [ 'Section1', 'section2', 'section3', 'section4' ]; plot2 = $.jqplot('chart3', [ s1, s2, s3 ], { animate : !$.jqplot.use_excanvas, seriesDefaults : { renderer : $.jqplot.BarRenderer, pointLabels : { show : true }, rendererOptions : { barPadding : 8, // number of pixels between // adjacent bars in the same

Categories : Java

JPA: Multiple values matching multiple values
I don't know perfect solution, but this will work: public List<Document> documentsByTags(List<String> tagNames) { CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<Document> criteriaQuery = criteriaBuilder.createQuery(Document.class); Root<Document> documents = criteriaQuery.from(Document.class); List<Predicate> predicates = new ArrayList<Predicate>(); for (String tagName : tagNames) { Subquery<Long> sq = criteriaQuery.subquery(Long.class); Root<Tag> tags = sq.from(Tag.class); sq.select(tags.<Long>get("documents")).where( criteriaBuilder.equal(tags.get("name"), tagName); predicates.add(criteriaBuilder.in(documents.<Long> get("id")).

Categories : Java

Concatenating multiple values returned by function with multiple variables without using temporary variables
What you ask is not generally possible. However, we can do some looping to abstract over the number of return values: my @strings = ("some text", "some other text"); my @ret = multi_return; $strings[$_] .= $ret[$_] for 0 .. $#strings; We can write a sub that in turn abstracts over that: sub append_all { my $suffixes = shift; $_ .= shift @$suffixes for @_; # uses aliasing behaviour to modify out-args } my $string1 = "some text"; my $string2 = "some other text"; append_all([multi_return()] => $string1, $string2);

Categories : Perl

Multiple X-Axis for Chart In Reporting Services
Assuming you have two series in your Chart for the bar and line values you're displaying: You need to set the Value axis for each of these Series: If you set one Series to a Primary Value axis and the other to a Secondary Value axis you will get a left and right axis as above and hopefully each Series will have one axis correctly set. Based on your description you should set up one Category group as appropriate and make sure both Series have the same Category axis value set.

Categories : Sql Server

Multiple axis line chart in excel
There is a way of displaying 3 Y axis see here. Excel supports Secondary Axis, i.e. only 2 Y axis. Other way would be to chart the 3rd one separately, and overlay on top of the main chart.

Categories : Excel

asp.net ms chart control multiple columns for x-axis
You should go here ms chart samples and code go the the download tab and download both or the one you need, it helped me a lot to understand how the ms chart works, the samples are usefull.

Categories : Asp Net

Multiple Y-Axis Google chart with Json data
The problem is twofold: 1) ScatterCharts don't support multiple vertical axes. Depending on the structure of your data (and yours looks fine for this if the sample DataTable above is representative of your data), you can emulate a ScatterChart using a LineChart. You just need to set the "lineWidth" option to 0. 2) You need to assign at least one data series to each axis, or the right vAxis won't draw. Try this: // Load the Visualization API and the piechart package. google.load('visualization', '1', {'packages':['corechart']}); // Set a callback to run when the Google Visualization API is loaded. google.setOnLoadCallback(drawChart); function drawChart() { // Create our data table out of JSON data loaded from server. var data = new google.visualization.DataTable(<?=$jsonTa

Categories : Json



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.