Skip to content

Commit

Permalink
Merge pull request #2 from ramiy/master
Browse files Browse the repository at this point in the history
Version 0.3.0
  • Loading branch information
ramiy authored Oct 13, 2020
2 parents 39713e1 + b8a9736 commit 5bc5d64
Show file tree
Hide file tree
Showing 20 changed files with 1,227 additions and 823 deletions.
1,061 changes: 625 additions & 436 deletions dist/charts.css

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions dist/charts.css.map

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions dist/charts.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "charts.css",
"version": "0.2.0",
"description": "Open source data visualization framework using pure CSS.",
"version": "0.3.0",
"description": "Open source CSS framework for data visualization.",
"author": "Rami Yushuvaev",
"homepage": "https://ChartsCSS.org/",
"license": "MIT",
Expand Down Expand Up @@ -33,9 +33,6 @@
"bugs": {
"url": "https://github.com/ChartsCSS/charts.css/issues"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"devDependencies": {
"node-sass": "^4.14.1",
"nodemon": "^2.0.4",
Expand Down
9 changes: 4 additions & 5 deletions src/charts.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*!
* charts.css v0.2.0 (https://ChartsCSS.org/)
/*
* Charts.css v0.3.0 (https://ChartsCSS.org/)
* Copyright 2020 Rami Yushuvaev
* Licensed under MIT
*/

// Configuration
// General
@import "general/variables";
@import "general/mixins";
Expand All @@ -13,6 +12,7 @@

// Components
@import "components/wrapper";
@import "components/colors";
@import "components/legend";
@import "components/tooltips";

Expand All @@ -24,6 +24,5 @@

@import "charts/pie";
@import "charts/donut";
@import "charts/radar";
@import "charts/polar";
@import "charts/gauge"; // with a dial
@import "charts/radar";
88 changes: 47 additions & 41 deletions src/charts/_bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,12 @@
// Display cells in a column
display: flex;
justify-content: space-around;
flex-direction: column;

padding: 0;
margin: 0;

td {
// Even cell size
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;

width: 100%;
width: calc( 100% * var( --size, 1 ) );
height: 100%;

padding: 0;
Expand All @@ -69,7 +63,7 @@
}

// Labels Position
&:not(.end-labels) {
&:not(.labels-after) {
tbody {
tr {
align-items: flex-start;
Expand All @@ -86,7 +80,7 @@
}
}
}
&.end-labels {
&.labels-after {
tbody {
tr {
align-items: flex-end;
Expand All @@ -104,28 +98,28 @@
}
}

// Colors
&:not(.multiple) {
@for $i from 1 through $max-items {
tbody tr:nth-of-type( #{ $i } ) td,
tbody tr:nth-of-type( #{ $i + 10 } ) td,
tbody tr:nth-of-type( #{ $i + 20 } ) td,
tbody tr:nth-of-type( #{ $i + 30 } ) td,
tbody tr:nth-of-type( #{ $i + 40 } ) td,
tbody tr:nth-of-type( #{ $i + 50 } ) td {
background-color: var( --color, var( --color-#{ $i }));
// Stacked
&:not(.stacked) {
tbody tr {

td {
// Even cell size
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
}
}
}
&.multiple {
@for $i from 1 through $max-items {
tbody tr td:nth-of-type( #{ $i } ),
tbody tr td:nth-of-type( #{ $i + 10 } ),
tbody tr td:nth-of-type( #{ $i + 20 } ),
tbody tr td:nth-of-type( #{ $i + 30 } ),
tbody tr td:nth-of-type( #{ $i + 40 } ),
tbody tr td:nth-of-type( #{ $i + 50 } ) {
background-color: var( --color, var( --color-#{ $i }));
&.multiple.stacked {
tbody tr {
flex-direction: row;
justify-content: start;
align-items: flex-start;

td {
flex-grow: unset;
flex-shrink: unset;
flex-basis: unset;
}
}
}
Expand All @@ -141,25 +135,35 @@
flex-direction: column-reverse;
}
}
&:not(.reverse-datasets) {
tbody tr {
flex-direction: column;
}
}
&.reverse-datasets {
tbody tr {
flex-direction: column-reverse;
}
}

// Row Spacing
@for $i from 1 through 10 {
&.row-spacing {
@for $i from 1 through 20 {
&.row-spacing-#{$i} {
tbody tr {
padding-block-start: 4px;
padding-block-end: 4px;
padding-block-start: #{$i}px;
padding-block-end: #{$i}px;
}
}
}

// Axes
&.show-main-axis {
&:not(.end-labels) {
&:not(.labels-after) {
tbody tr {
border-inline-start: var( --main-axis-width ) var( --main-axis-style ) var( --main-axis-color );
}
}
&.end-labels {
&.labels-after {
tbody tr {
border-inline-end: var( --main-axis-width ) var( --main-axis-style ) var( --main-axis-color );
}
Expand All @@ -182,14 +186,16 @@
}
@for $i from 1 through $max-items {
&.show-#{$i}-y-axes {
tbody {
tr {
&:not(.labels-after) {
tbody tr {
background-size: ( 100% / $i ) 100%;
background-image: linear-gradient( -90deg, var( --axis-color ) var( --axis-width ), transparent var( --axis-width ) );
}
}
&.labels-after {
tbody tr {
background-size: ( 100% / $i ) 100%;
background-image: linear-gradient(
90deg,
var( --axis-color ) var( --axis-width ),
transparent var( --axis-width )
);
background-image: linear-gradient( 90deg, var( --axis-color ) var( --axis-width ), transparent var( --axis-width ) );
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/charts/_bubble.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
.charts-css {

&.bubble {
// Shape
@include rectangle();

// Background
background-color: var( --chart-bg-color );

caption,
colgroup,
tbody,
thead,
tfoot {
display: none;
}
}

}
87 changes: 50 additions & 37 deletions src/charts/_column.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,15 @@
// Display cells in a row
display: flex;
justify-content: space-around;
flex-direction: row;

padding: 0;
margin: 0;

text-align: center;

td {
// Even cell size
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;

width: 100%;
height: 100%;
height: calc( 100% * var( --size, 1 ) );

padding: 0;
margin: 0;
Expand All @@ -72,7 +66,7 @@
}

// Labels Position
&:not(.top-labels) {
&:not(.labels-before) {
tbody {
tr {
align-items: flex-end;
Expand All @@ -85,7 +79,7 @@
}
}
}
&.top-labels {
&.labels-before {
tbody {
tr {
align-items: flex-start;
Expand All @@ -99,20 +93,28 @@
}
}

// Colors
&:not(.multiple) {
@for $i from 1 through $max-items {
tbody tr:nth-of-type( #{ $i } ) td,
tbody tr:nth-of-type( #{ $i + $max-items } ) td {
background-color: var( --color, var( --color-#{ $i }));
// Stacked
&:not(.stacked) {
tbody tr {

td {
// Even cell size
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
}
}
}
&.multiple {
@for $i from 1 through $max-items {
tbody tr td:nth-of-type( #{ $i } ),
tbody tr td:nth-of-type( #{ $i + $max-items } ) {
background-color: var( --color, var( --color-#{ $i }));
&.stacked {
tbody tr {
flex-direction: column-reverse;
justify-content: start;
align-items: flex-start;

td {
flex-grow: unset;
flex-shrink: unset;
flex-basis: unset;
}
}
}
Expand All @@ -128,25 +130,35 @@
flex-direction: row-reverse;
}
}
&:not(.reverse-datasets) {
tbody tr {
flex-direction: row;
}
}
&.reverse-datasets {
tbody tr {
flex-direction: row-reverse;
}
}

// Row Spacing
@for $i from 1 through 10 {
&.row-spacing {
@for $i from 1 through 20 {
&.row-spacing-#{$i} {
tbody tr {
padding-inline-start: 4px;
padding-inline-end: 4px;
padding-inline-start: #{$i}px;
padding-inline-end: #{$i}px;
}
}
}

// Axes
&.show-main-axis {
&:not(.top-labels) {
&:not(.labels-before) {
tbody tr {
border-block-end: var( --main-axis-width ) var( --main-axis-style ) var( --main-axis-color );
}
}
&.top-labels {
&.labels-before {
tbody tr {
border-block-start: var( --main-axis-width ) var( --main-axis-style ) var( --main-axis-color );
}
Expand All @@ -167,18 +179,19 @@
}
}
}
@for $i from 1 through 10 {
@for $i from 1 through $max-items {
&.show-#{$i}-x-axes {
tbody {
background-size: 100% ( 100% / $i );
background-image: linear-gradient(
var( --axis-color ) var( --axis-width ),
transparent var( --axis-width )
);

// tr {
// border-block-start-color: transparent;
// }
&:not(.labels-before) {
tbody tr {
background-size: 100% ( 100% / $i );
background-image: linear-gradient( var( --axis-color ) var( --axis-width ), transparent var( --axis-width ) );
}
}
&.labels-before {
tbody tr {
background-size: 100% ( 100% / $i );
background-image: linear-gradient( 0deg, var( --axis-color ) var( --axis-width ), transparent var( --axis-width ) );
}
}
}
}
Expand Down
Loading

0 comments on commit 5bc5d64

Please sign in to comment.