Skip to content

Instantly share code, notes, and snippets.

@alansmithy
Last active June 8, 2017 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alansmithy/b4a82ce15e3eb26930540f281adb4805 to your computer and use it in GitHub Desktop.
Save alansmithy/b4a82ce15e3eb26930540f281adb4805 to your computer and use it in GitHub Desktop.
Scalable grid
license: mit
id name party country
E14000792 Lincoln c E
E14001057 Wyre and Preston North c E
S14000054 Perth and North Perthshire snp S
S14000013 Dumfries and Galloway snp S
W07000049 Aberavon lab W
S14000001 Aberdeen North snp S
S14000002 Aberdeen South snp S
S14000058 West Aberdeenshire and Kincardine snp S
E14000530 Aldershot c E
W07000043 Alyn and Deeside lab W
E14000814 Mid Derbyshire c E
E14000972 Stoke-on-Trent Central lab E
S14000004 Angus snp S
N06000005 East Antrim dup N
N06000012 North Antrim dup N
N06000014 South Antrim uup N
S14000005 Argyll and Bute snp S
E14000534 Arundel and South Downs c E
E14000536 Ashford c E
E14000538 Aylesbury c E
E14000539 Banbury c E
S14000007 Banff and Buchan snp S
E14000543 Barrow and Furness lab E
E14000544 Basildon and Billericay c E
E14000545 Basingstoke c E
E14000546 Bassetlaw lab E
E14000547 Bath c E
E14000550 Beaconsfield c E
E14000552 Bedford c E
E14000813 Mid Bedfordshire c E
E14000841 North East Bedfordshire c E
E14000949 South West Bedfordshire c E
N06000001 Belfast East dup N
N06000002 Belfast North dup N
N06000003 Belfast South sdlp N
N06000004 Belfast West sf N
E14000554 Berwick-upon-Tweed c E
E14000556 Beverley and Holderness c E
E14000557 Bexhill and Battle c E
E14000933 South Basildon and East Thurrock c E
E14000569 Bishop Auckland lab E
E14000769 Kettering c E
E14000570 Blackburn lab E
E14000572 Blackpool North and Cleveleys c E
E14000573 Blackpool South lab E
W07000072 Blaenau Gwent lab W
E14000622 Castle Point c E
W07000066 Carmarthen West and South Pembrokeshire c W
W07000067 Carmarthen East and Dinefwr pc W
W07000079 Cardiff West lab W
W07000080 Cardiff South and Penarth lab W
W07000051 Cardiff North c W
W07000050 Cardiff Central lab W
E14000619 Canterbury c E
E14000618 Cannock Chase c E
E14000660 Daventry c E
E14000937 South East Cambridgeshire c E
E14000934 South Cambridgeshire c E
E14000855 North West Cambridgeshire c E
E14000842 North East Cambridgeshire c E
E14000617 Cambridge lab E
S14000009 Caithness, Sutherland and Easter Ross snp S
W07000076 Caerphilly lab W
W07000057 Arfon pc W
E14000613 Bury St Edmunds c E
E14000610 Burton c E
E14000609 Burnley lab E
E14000608 Buckingham c E
E14000533 Amber Valley c E
E14000606 Broxbourne c E
E14000818 Mid Worcestershire c E
E14000602 Bristol West lab E
E14000601 Bristol South lab E
E14000600 Bristol North West c E
E14000598 Brighton, Pavilion green E
E14000597 Brighton, Kemptown c E
E14000596 Brigg and Goole c E
E14000595 Bridgwater and West Somerset c E
W07000073 Bridgend lab W
E14000594 Brentwood and Ongar c E
W07000068 Brecon and Radnorshire c W
E14000590 Braintree c E
E14000586 Bracknell c E
E14000585 Bournemouth West c E
E14000584 Bournemouth East c E
E14000583 Bosworth c E
E14000582 Boston and Skegness c E
E14000577 Bolsover lab E
E14000576 Bognor Regis and Littlehampton c E
E14000575 Blyth Valley lab E
E14000574 Blaydon lab E
W07000064 Ceredigion ld W
E14000625 Charnwood c E
E14000626 Chatham and Aylesford c E
E14000628 Chelmsford c E
E14000630 Cheltenham c E
E14000631 Chesham and Amersham c E
E14000640 City of Chester lab E
E14000632 Chesterfield lab E
E14000633 Chichester c E
E14000637 Chorley lab E
E14000638 Christchurch c E
E14000643 Cleethorpes c E
W07000062 Clwyd South lab W
W07000059 Clwyd West c W
E14000644 Colchester c E
E14000646 Congleton c E
W07000058 Aberconwy c W
E14000647 Copeland lab E
E14000942 South Northamptonshire c E
E14000837 North Cornwall c E
E14000938 South East Cornwall c E
E14000991 The Cotswolds c E
E14000652 Crawley c E
E14000653 Crewe and Nantwich c E
W07000070 Cynon Valley lab W
E14000658 Darlington lab E
E14000659 Dartford c E
E14000977 Stratford-on-Avon c E
W07000042 Delyn lab W
E14000662 Derby North c E
E14000663 Derby South lab E
E14000843 North East Derbyshire lab E
E14000935 South Derbyshire c E
E14000664 Derbyshire Dales c E
E14000665 Devizes c E
E14000678 East Devon c E
E14000623 Central Devon c E
E14000950 South West Devon c E
E14001000 Torridge and West Devon c E
E14000815 Mid Dorset and North Poole c E
E14000839 North Dorset c E
E14000936 South Dorset c E
E14001031 West Dorset c E
E14000670 Dover c E
E14000711 Gillingham and Rainham c E
E14000607 Broxtowe c E
E14001020 Washington and Sunderland West lab E
E14000707 Gainsborough c E
E14000706 Fylde c E
N06000008 Foyle sdlp N
E14000705 Forest of Dean c E
E14000704 Folkestone and Hythe c E
N06000007 Fermanagh and South Tyrone uup N
E14000700 Faversham and Mid Kent c E
E14000699 Fareham c E
E14000616 Camborne and Redruth c E
E14000698 Exeter lab E
E14001045 Witham c E
E14000697 Esher and Walton c E
E14000695 Erewash c E
E14000694 Epsom and Ewell c E
E14000693 Epping Forest c E
E14000688 Ellesmere Port and Neston lab E
E14000686 Eddisbury c E
E14000685 Eastleigh c E
E14000684 Eastbourne c E
E14000641 City of Durham lab E
E14000856 North West Durham lab E
E14000840 North Durham lab E
S14000015 Dundee East snp S
S14000016 Dundee West snp S
N06000015 South Down sdlp N
N06000013 North Down other N
E14000712 Gloucester c E
S14000037 Gordon snp S
E14000713 Gosport c E
W07000046 Gower c W
E14000714 Grantham and Stamford c E
E14000715 Gravesham c E
E14000716 Great Grimsby lab E
E14000717 Great Yarmouth c E
E14000719 Guildford c E
E14000725 Halton lab E
E14000680 East Hampshire c E
E14000844 North East Hampshire c E
E14000857 North West Hampshire c E
E14001025 Wellingborough c E
E14000729 Harlow c E
E14000730 Harrogate and Knaresborough c E
E14000733 Hartlepool lab E
E14000734 Harwich and North Essex c E
E14000735 Hastings and Rye c E
E14000736 Havant c E
E14000739 Hemel Hempstead c E
E14000742 Henley c E
E14000743 Hereford and South Herefordshire c E
E14000744 Hertford and Stortford c E
E14000845 North East Hertfordshire c E
E14001021 Watford c E
E14000745 Hertsmere c E
E14000746 Hexham c E
E14000749 Hitchin and Harpenden c E
E14000753 Horsham c E
E14000677 Easington lab E
E14000755 Hove lab E
E14000771 East Hull lab E
E14000772 North Hull lab E
E14000773 West Hull and Hessle lab E
E14000806 Maldon c E
E14000804 Maidstone and The Weald c E
E14000803 Maidenhead c E
E14000802 Macclesfield c E
E14000801 Luton South lab E
E14000800 Luton North lab E
E14000847 North Herefordshire c E
E14000798 Louth and Horncastle c E
E14000797 Loughborough c E
N06000006 East Londonderry dup N
W07000045 Llanelli lab W
E14000710 Gedling lab E
E14000791 Lichfield c E
E14000786 Lewes c E
E14000605 Bromsgrove c E
E14000858 North West Leicestershire c E
E14000784 Leicester West lab E
E14000783 Leicester South lab E
E14000782 Leicester East lab E
E14000776 Lancaster and Fleetwood lab E
E14001033 West Lancashire lab E
N06000009 Lagan Valley dup N
E14000774 Kingswood c E
E14000878 Peterborough c E
E14000765 Jarrow lab E
W07000077 Islwyn lab W
E14000762 Isle of Wight c E
E14000761 Ipswich c E
S14000039 Inverness, Nairn, Badenoch and Strathspey snp S
E14000758 Hyndburn lab E
E14000757 Huntingdon c E
E14000810 Mansfield lab E
E14000898 Rochester and Strood c E
W07000061 Dwyfor Meirionnydd pc W
W07000071 Merthyr Tydfil and Rhymney lab W
E14000819 Middlesbrough lab E
E14000820 Middlesbrough South and East Cleveland lab E
E14000651 Coventry South lab E
E14000822 Milton Keynes South c E
E14000824 Mole Valley c E
W07000054 Monmouth c W
W07000063 Montgomeryshire c W
S14000046 Moray snp S
E14000825 Morecambe and Lunesdale c E
W07000069 Neath lab W
E14000827 New Forest East c E
E14000828 New Forest West c E
E14000829 Newark c E
E14000830 Newbury c E
E14000834 Newcastle-under-Lyme lab E
E14000831 Newcastle upon Tyne Central lab E
E14000832 Newcastle upon Tyne East lab E
E14000833 Newcastle upon Tyne North lab E
W07000055 Newport East lab W
W07000056 Newport West lab W
N06000011 Newry and Armagh sf N
E14000848 North Norfolk ld E
E14000859 North West Norfolk c E
E14001022 Waveney c E
E14000941 South Norfolk c E
E14000940 South Leicestershire c E
E14000812 Meriden c E
E14000994 Thornbury and Yate c E
E14000863 Norwich North c E
E14000865 Nottingham East lab E
E14000866 Nottingham North lab E
E14000867 Nottingham South lab E
E14000648 Corby c E
S14000050 Ochil and South Perthshire snp S
W07000074 Ogmore lab W
E14000873 Oxford East lab E
E14000874 Oxford West and Abingdon c E
E14000875 Pendle c E
E14000877 Penrith and The Border c E
S14000049 North East Fife snp S
E14000952 South West Norfolk c E
E14000879 Plymouth, Moor View c E
E14000880 Plymouth, Sutton and Devonport c E
W07000075 Pontypridd lab W
E14000881 Poole c E
E14000883 Portsmouth North c E
E14000884 Portsmouth South c E
E14000956 Southampton, Test lab E
E14000955 Southampton, Itchen c E
E14000944 South Shields lab E
E14000603 Broadland c E
E14000939 South Holland and The Deepings c E
E14000932 Somerton and Frome c E
E14000930 Slough lab E
E14000929 Sleaford and North Hykeham c E
E14000928 Skipton and Ripon c E
E14000927 Sittingbourne and Sheppey c E
E14000849 North Shropshire c E
E14000926 Shrewsbury and Atcham c E
E14000924 Sherwood c E
E14000918 Sevenoaks c E
E14000917 Selby and Ainsty c E
E14000915 Sedgefield lab E
E14000914 Scunthorpe lab E
E14000913 Scarborough and Whitby c E
E14000912 Salisbury c E
E14000964 St Ives c E
E14000960 St Albans c E
E14000910 Saffron Walden c E
E14000993 Thirsk and Malton c E
E14000909 Rutland and Melton c E
E14000908 Rushcliffe c E
E14000907 Runnymede and Weybridge c E
E14000905 Rugby c E
E14000902 Rossendale and Darwen c E
S14000055 Ross, Skye and Lochaber snp S
E14000901 Romsey and Southampton North c E
E14000899 Rochford and Southend East c E
E14000895 Richmond (Yorks) c E
E14000894 Ribble Valley c E
E14000943 South Ribble c E
W07000052 Rhondda lab W
E14000893 Reigate c E
E14000767 Kenilworth and Southam c E
E14000891 Redcar lab E
E14000890 Reading West c E
E14000889 Reading East c E
E14000888 Rayleigh and Wickford c E
E14000885 Preston lab E
W07000065 Preseli Pembrokeshire c W
E14000957 Southend West c E
E14000959 Spelthorne c E
E14000965 Stafford c E
E14000966 Staffordshire Moorlands c E
E14000945 South Staffordshire c E
E14000968 Stevenage c E
S14000057 Stirling snp S
E14000970 Stockton North lab E
E14000971 Stockton South c E
E14000973 Stoke-on-Trent North lab E
E14000974 Stoke-on-Trent South lab E
E14000975 Stone c E
N06000016 Strangford dup N
E14000821 Milton Keynes North c E
E14000980 Stroud c E
E14000624 Central Suffolk and North Ipswich c E
E14000946 South Suffolk c E
E14000642 Clacton ukip E
E14001034 West Suffolk c E
E14000982 Sunderland Central lab E
E14000754 Houghton and Sunderland South lab E
E14000681 East Surrey c E
E14000983 Surrey Heath c E
E14000953 South West Surrey c E
E14000817 Mid Sussex c E
W07000047 Swansea West lab W
E14000851 North Swindon c E
E14000947 South Swindon c E
E14000986 Tamworth c E
E14000987 Tatton c E
E14000988 Taunton Deane c E
E14000835 Newton Abbot c E
E14000799 Ludlow c E
E14000990 Tewkesbury c E
E14000852 North Thanet c E
E14000948 South Thanet c E
E14000995 Thurrock c E
E14000996 Tiverton and Honiton c E
E14000997 Tonbridge and Malling c E
E14000999 Torbay c E
W07000053 Torfaen lab W
E14001001 Totnes c E
E14001003 Truro and Falmouth c E
E14001004 Tunbridge Wells c E
E14000709 Gateshead lab E
E14001006 Tynemouth lab E
E14000853 North Tyneside lab E
N06000018 West Tyrone sf N
N06000010 Mid Ulster sf N
N06000017 Upper Bann dup N
E14000683 East Yorkshire c E
E14001061 York Central lab E
W07000041 Ynys M��n lab W
E14001060 Yeovil c E
E14001058 Wyre Forest c E
E14001056 Wycombe c E
W07000044 Wrexham lab W
E14000992 The Wrekin c E
E14001055 Worthing West c E
E14000682 East Worthing and Shoreham c E
E14001053 Workington lab E
E14001035 West Worcestershire c E
E14000892 Redditch c E
E14001052 Worcester c E
E14000850 North Somerset c E
E14001048 Wokingham c E
E14001047 Woking c E
E14001046 Witney c E
E14001042 Windsor c E
E14001041 Winchester c E
E14000860 North Wiltshire c E
E14001038 Weston-Super-Mare c E
E14001037 Westmorland and Lonsdale ld E
E14000954 South West Wiltshire c E
E14001027 Welwyn Hatfield c E
E14001026 Wells c E
E14000728 Harborough c E
E14001024 Weaver Vale c E
E14001023 Wealden c E
E14000981 Suffolk Coastal c E
E14000951 South West Hertfordshire c E
E14000854 North Warwickshire c E
E14001019 Warwick and Leamington c E
E14001018 Warrington South c E
E14001017 Warrington North lab E
E14001015 Wantage c E
E14000846 North East Somerset c E
E14001014 Wansbeck lab E
E14001062 York Outer c E
W07000078 Vale of Glamorgan c W
W07000060 Vale of Clwyd c W
E14001044 Wirral West lab E
E14000958 Southport ld E
E14001039 Wigan lab E
E14000963 St Helens South and Whiston lab E
E14000708 Garston and Halewood lab E
E14000805 Makerfield lab E
E14000580 Bolton West c E
E14000785 Leigh lab E
E14000962 St Helens North lab E
E14000775 Knowsley lab E
E14000916 Sefton Central lab E
E14000794 Liverpool, Walton lab E
E14000795 Liverpool, Wavertree lab E
E14000796 Liverpool, West Derby lab E
E14000979 Stretford and Urmston lab E
E14000532 Altrincham and Sale West c E
E14000747 Heywood and Middleton lab E
E14000612 Bury South lab E
E14000579 Bolton South East lab E
E14001054 Worsley and Eccles South lab E
E14000611 Bury North c E
E14000578 Bolton North East lab E
E14000871 Oldham West and Royton lab E
E14000537 Ashton-under-Lyne lab E
E14000807 Manchester Central lab E
E14000571 Blackley and Broughton lab E
E14000911 Salford and Eccles lab E
E14000661 Denton and Reddish lab E
E14000969 Stockport lab E
E14000808 Manchester, Gorton lab E
E14000627 Cheadle c E
E14001059 Wythenshawe and Sale East lab E
E14000809 Manchester, Withington lab E
E14000967 Stalybridge and Hyde lab E
E14000738 Hazel Grove c E
E14000589 Bradford West lab E
E14000766 Keighley c E
E14000780 Leeds North West ld E
E14000777 Leeds Central lab E
E14000779 Leeds North East lab E
E14000778 Leeds East lab E
E14000781 Leeds West lab E
E14000886 Pudsey c E
E14000587 Bradford East lab E
E14000925 Shipley c E
E14000756 Huddersfield lab E
E14000836 Normanton, Pontefract and Castleford lab E
E14000548 Batley and Spen lab E
E14000826 Morley and Outwood c E
E14000588 Bradford South lab E
E14000723 Halifax lab E
E14000666 Dewsbury lab E
E14000724 Haltemprice and Howden c E
E14000689 Elmet and Rothwell c E
E14000919 Sheffield Central lab E
E14000923 Sheffield, Heeley lab E
E14000922 Sheffield, Hallam ld E
E14000748 High Peak c E
E14000904 Rotherham lab E
E14000921 Sheffield, Brightside and Hillsborough lab E
E14000541 Barnsley Central lab E
E14000669 Doncaster North lab E
E14000668 Doncaster Central lab E
E14000667 Don Valley lab E
E14000903 Rother Valley lab E
E14000920 Sheffield South East lab E
E14000542 Barnsley East lab E
E14001028 Wentworth and Dearne lab E
E14000876 Penistone and Stocksbridge lab E
E14000740 Hemsworth lab E
E14001009 Wakefield lab E
E14000645 Colne Valley c E
E14000614 Calder Valley c E
E14000870 Oldham East and Saddleworth lab E
E14000897 Rochdale lab E
E14000793 Liverpool, Riverside lab E
E14001043 Wirral South lab E
E14000559 Birkenhead lab E
E14000581 Bootle lab E
E14001010 Wallasey lab E
E14001007 Uxbridge and South Ruislip c E
E14000676 Ealing, Southall lab E
E14001005 Twickenham c E
E14000701 Feltham and Heston lab E
E14001040 Wimbledon c E
E14000896 Richmond Park c E
E14000984 Sutton and Cheam c E
E14000770 Kingston and Surbiton c E
E14000741 Hendon c E
E14000592 Brent North lab E
E14000731 Harrow East c E
E14000675 Ealing North lab E
E14000737 Hayes and Harlington lab E
E14000732 Harrow West lab E
E14000906 Ruislip, Northwood and Pinner c E
E14000768 Kensington c E
E14000726 Hammersmith lab E
E14000692 Enfield, Southgate c E
E14000752 Hornsey and Wood Green lab E
E14000636 Chipping Barnet c E
E14000656 Croydon South c E
E14000634 Chingford and Woodford Green c E
E14001013 Walthamstow lab E
E14000687 Edmonton lab E
E14000720 Hackney North and Stoke Newington lab E
E14001002 Tottenham lab E
E14000751 Hornchurch and Upminster c E
E14000759 Ilford North lab E
E14000657 Dagenham and Rainham lab E
E14000558 Bexleyheath and Crayford c E
E14000900 Romford c E
E14000872 Orpington c E
E14000869 Old Bexley and Sidcup c E
E14000690 Eltham lab E
E14000787 Lewisham East lab E
E14000604 Bromley and Chislehurst c E
E14000718 Greenwich and Woolwich lab E
E14000679 East Ham lab E
E14000696 Erith and Thamesmead lab E
E14000790 Leyton and Wanstead lab E
E14001032 West Ham lab E
E14000691 Enfield North lab E
E14000760 Ilford South lab E
E14000540 Barking lab E
E14000553 Bermondsey and Old Southwark lab E
E14000882 Poplar and Limehouse lab E
E14000555 Bethnal Green and Bow lab E
E14000721 Hackney South and Shoreditch lab E
E14000764 Islington South and Finsbury lab E
E14000727 Hampstead and Kilburn lab E
E14000703 Finchley and Golders Green c E
E14001036 Westminster North lab E
E14000591 Brent Central lab E
E14000674 Ealing Central and Acton lab E
E14000593 Brentford and Isleworth lab E
E14001008 Vauxhall lab E
E14000639 Cities of London and Westminster c E
E14000763 Islington North lab E
E14000750 Holborn and St Pancras lab E
E14000615 Camberwell and Peckham lab E
E14000673 Dulwich and West Norwood lab E
E14000551 Beckenham c E
E14000654 Croydon Central c E
E14000788 Lewisham West and Penge lab E
E14000789 Lewisham, Deptford lab E
E14000978 Streatham lab E
E14000655 Croydon North lab E
E14000621 Carshalton and Wallington ld E
E14000823 Mitcham and Morden lab E
S14000051 Orkney and Shetland ld S
E14000887 Putney c E
E14000998 Tooting lab E
E14000549 Battersea c E
E14000862 Northampton South c E
E14000649 Coventry North East lab E
E14000861 Northampton North c E
E14000985 Sutton Coldfield c E
E14000561 Birmingham, Erdington lab E
E14000563 Birmingham, Hodge Hill lab E
E14000868 Nuneaton c E
E14000565 Birmingham, Northfield lab E
E14000566 Birmingham, Perry Barr lab E
E14000564 Birmingham, Ladywood lab E
E14000560 Birmingham, Edgbaston lab E
E14001029 West Bromwich East lab E
E14000722 Halesowen and Rowley Regis c E
E14001030 West Bromwich West lab E
E14000671 Dudley North lab E
E14000672 Dudley South c E
E14000976 Stourbridge c E
E14000531 Aldridge-Brownhills c E
E14001011 Walsall North lab E
E14001012 Walsall South lab E
E14001049 Wolverhampton North East lab E
E14001050 Wolverhampton South East lab E
E14001051 Wolverhampton South West lab E
E14001016 Warley lab E
E14000562 Birmingham, Hall Green lab E
E14000931 Solihull c E
E14000567 Birmingham, Selly Oak lab E
E14000568 Birmingham, Yardley lab E
E14000864 Norwich South lab E
E14000816 Mid Norfolk c E
E14000620 Carlisle c E
S14000006 Ayr, Carrick and Cumnock snp S
S14000008 Berwickshire, Roxburgh and Selkirk snp S
S14000059 West Dunbartonshire snp S
S14000014 Dumfriesshire, Clydesdale and Tweeddale c S
S14000027 Na h-Eileanan an Iar snp S
S14000045 Midlothian snp S
S14000020 East Lothian snp S
S14000040 Kilmarnock and Loudoun snp S
S14000019 East Kilbride, Strathaven and Lesmahagow snp S
S14000047 Motherwell and Wishaw snp S
S14000003 Airdrie and Shotts snp S
S14000044 Livingston snp S
S14000023 Edinburgh North and Leith snp S
S14000043 Linlithgow and East Falkirk snp S
S14000028 Falkirk snp S
S14000041 Kirkcaldy and Cowdenbeath snp S
S14000017 Dunfermline and West Fife snp S
S14000021 East Renfrewshire snp S
S14000052 Paisley and Renfrewshire North snp S
S14000053 Paisley and Renfrewshire South snp S
S14000010 Central Ayrshire snp S
S14000048 North Ayrshire and Arran snp S
S14000011 Coatbridge, Chryston and Bellshill snp S
S14000012 Cumbernauld, Kilsyth and Kirkintilloch East snp S
S14000018 East Dunbartonshire snp S
S14000022 Edinburgh East snp S
S14000026 Edinburgh West snp S
S14000025 Edinburgh South West snp S
S14000024 Edinburgh South lab S
S14000036 Glenrothes snp S
S14000038 Inverclyde snp S
S14000042 Lanark and Hamilton East snp S
S14000056 Rutherglen and Hamilton West snp S
S14000032 Glasgow North East snp S
S14000030 Glasgow East snp S
S14000031 Glasgow North snp S
S14000034 Glasgow South snp S
S14000033 Glasgow North West snp S
S14000035 Glasgow South West snp S
S14000029 Glasgow Central snp S
W07000048 Swansea East lab W
E14000961 St Austell and Newquay c E
E14000838 North Devon c E
E14000702 Filton and Bradley Stoke c E
E14000635 Chippenham c E
E14000535 Ashfield lab E
E14000629 Chelsea and Fulham c E
E14000811 Meon Valley c E
E14000989 Telford c E
E14000599 Bristol East lab E
E14000650 Coventry North West lab E
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
.bg{fill:#fff1e0}
.grid{fill:#dedede}
.highlight{fill:#bb6d82}
</style>
</head>
<body>
<script>
//canvas size
const w = 960;
const h = 500;
const margin = {left:10,right:10,top:10,bottom:10};
/*=For 'type', use 'rect', 'ellipse', or a custom shape defined in the defs section. The geometry of a custom icon will over-ride the width/height settings here*/
const grid = {type:"ellipse",
width:15,
height:15 ,
cols:25,
rows:26,
direction:"across",
highlight:330,
padding:{top:1,left:1,bottom:1,right:1}}
const svg = d3.select("body").append("svg")
.attr("width", w)
.attr("height", h);
const defs = svg.append("defs")
defs.append("g")
.attr("id","custom")
.append("polygon")
.attr("points","12.5,0.9 16.3,8.5 24.7,9.8 18.6,15.7 20.1,24.1 12.5,20.2 4.9,24.1 6.4,15.7 0.3,9.8 8.7,8.5");
defs.append("g")
.attr("id","custom2")
.append("path")
.attr("d","M10.2,12l13,3.1c-1.3,4.6-5.6,8-10.6,8c-6.1,0-11.1-5-11.1-11.1S6.4,1,12.5,1c5,0,9.3,3.4,10.6,8L10.2,12zM12.5,2.7c-1,0-1.9,0.8-1.9,1.9s0.8,1.9,1.9,1.9s1.9-0.8,1.9-1.9S13.5,2.7,12.5,2.7z")
const inner = {width:w-(margin.left+margin.right),height:h-(margin.top+margin.bottom)};
//background
svg.append("rect")
.attr("class","bg")
.attr("x",margin.left)
.attr("y",margin.right)
.attr("width",inner.width)
.attr("height",inner.height)
var icons = svg.append("g")
.attr("transform","translate("+margin.left+","+margin.top+")")
//call function
buildGrid(grid,icons);
function buildGrid(config,element){
//create a d3 range of the number of required elements
const gridIndex = d3.range(config.cols*config.rows);
let shape;
switch(config.type) {
case "rect":
shape = "rect";
break;
case "ellipse":
shape = "ellipse";
break;
default:
shape = "use";
}
const grid = element.append("g")
.attr("class","grid")
.selectAll(shape)
.data(gridIndex)
.enter()
.append(shape)
.attr("id",function(d,i){
return shape+i;
})
.attr("class",function(d){
if (d<config.highlight){
return "highlight"
} else {
return "grid"
}
})
switch(shape){
case "rect":
grid.attr("width",config.width-(config.padding.left+config.padding.right))
.attr("height",config.height-(config.padding.top+config.padding.bottom))
.attr("x",function(d,i){
var colIndex =d % config.cols;
return colIndex*config.width
})
.attr("y",function(d,i){
var rowIndex=Math.floor(d/config.cols)
return rowIndex*config.height;
});
break;
case "ellipse":
grid.attr("ry",(config.height-(config.padding.top+config.padding.bottom))/2)
grid.attr("rx",(config.height-(config.padding.left+config.padding.right))/2)
.attr("cx",function(d,i){
var colIndex =d % config.cols;
return colIndex*config.width+(config.width/2)
})
.attr("cy",function(d,i){
var rowIndex=Math.floor(d/config.cols)
return rowIndex*config.height+(config.height/2);
})
break;
case "use":
grid.attr("xlink:href","#"+config.type)
.attr("x",function(d,i){
var colIndex =d % config.cols;
return colIndex*config.width
}).attr("y",function(d,i){
var rowIndex=Math.floor(d/config.cols)
return rowIndex*config.height;
})
.attr("width",config.width-(config.padding.left+config.padding.right))
.attr("height",config.height-(config.padding.top+config.padding.bottom))
}
}
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment