React Native

React Native

1650722400

Choosy: An App That Creates Photo Polls Where Others Can Vote

Choosy - Create photo polls

The freshest mobile application for your photo polls! 
Explorethe docs » 
 

Introduction

Choosy is a user-based app that allows others to vote on which of your photos they think should be uploaded on your social media accounts!

Product Name Screen Shot

App concept

Being authentic is what the internet is all about! But in a world where we take so many photos, it’s not always easy deciding which one is best! We ask for our friends’ opinions and spend hours trying to choose, often with no success.

And that’s how we got inspired to create Choosy!

  • Create photo polls! Don’t waste time trying to choose between two or more photos. Let our community help you!
  • Get real opinions from real users! Don’t limit yourself to just a few friends. Choosy gives you the ability to collect feedback from a variety of people, each with their own unique way of thinking.
  • Be active and help others decide! Just like you, other users also appreciate help! Select the pictures that you think will get the most likes. Your opinion counts!
  • Find the best photo! After your polls expire, only the best voted photos remain. The only thing you have to do is upload them on your social media accounts and stun your followers and friends!

(back to top)

Targets

Our main goal was to produce an application that is:

  • performant
  • scalable
  • maintainable
  • secure
  • easy to use

We regard our final product to be a success, since through stress and user testing we came to the conclusion that all of the above requirments were fulfilled to a satisfying degree. Additionally, we received a decent amount of user feedback, the vast majority of which was strongly positive (also indicated by our reviews on both App store and Play store).

(back to top)

Implementation

With regard to the principles mentioned above, we used the following technologies for the development of the app:

More details about the implementation and practises used can be found inside the frontend and backend folders.

(back to top)

Creators

This project was created by Apostolis Garos and Nikos Vlachakis, two undergraduate students studying Electrical and Computer Engineering at National Technical University of Athens.

We both contributed at every part of the design, development and deployment of the entire system and application. Coming from a period of thoroughly studying software engineering through university classes and personal online research, this was our first production level project.

(back to top)

Contact

Apostolis Garos - LinkedIn - apostolisgaros@gmail.com

Nikos Vlachakis - LinkedIn - nvlachakis1999@gmail.com

(back to top)


Author: ChoosyApp
Source Code: https://github.com/ChoosyApp/Choosy
License:  MPL-2.0 License

#react-native 

What is GEEK

Buddha Community

Choosy: An App That Creates Photo Polls Where Others Can Vote

Build a Pie, Bar, Line, and Point Chart Using CSS

Not to worry! Often all you need to make is a simple list or table, then add a bit of CSS to transform it into a chart.

Let us say we did a poll on whether or not to do a Firefly reboot with a new cast. This could be our dataset:

Yay:   35%
Nay:   55%
Blank: 10%;

Shiny! Now, not all chart types are appropriate for these data . A line chart should for example display a series, not categories — but we are going to do it anyway, just to demonstrate how to do it.

I will not go into too many details on the CSS, explaining how a specific attribute works. Use it as-is, or adjust it and in the process maybe learn a CSS attribute you did not know before. Also note that these are simple charts; if you need tooltips, animations, or advanced functionality, then a chart library may be more suited.

You can find the code as well at GitHub.

The Markup

Let us assume that we have loaded the data, but we have not yet decided on how to display it. Instead of delaying the process, we simply render it at a HTML list, decorate it with some CSS variables that describe the data, and hand it over to the designers.

We will set these CSS variables:

  • label: The type of vote (Yay, Nay, Blank)
  • value: The percentages for each vote.
  • value-text: The value as text.
  • previous-value: Value of the previous data item.
  • previous-sum: Sum of all previous values.
  • count: The number of data items.
  • color: The desired color.

The values for these variables are easy to get from the data. We access them in CSS using var(--my-variable)

If you already know which chart you are going to make, you probably don’t need the full list of variables.

Using our favorite framework or vanilla JS we create a list item for each data item and set the variables as inline styles, resulting in the following markup:


<ul id="votes" style="--count: 3;">
  <li style="
    --label: 'Yay'; --value: 35%; --value-text: '25%'; 
    --previous-value: 0%; --previous-sum: 0%;
    --color: green;"></li>
  <li style="
    --label: 'Nay'; --value: 55%; --value-text: '55%'; 
    --previous-value: 35%; --previous-sum: 35%;
    --color: red;"></li>
  <li style="
    --label: 'Blank'; --value: 10%; --value-text: '10%'; 
    --previous-value: 55%; --previous-sum: 90%;
    --color: blue;"></li>
</ul>

We now have something we can style, and that makes us mighty!

Overall Styling

Let us start by adding a basic styling to remove the ‘list-look’, and set an overall size of the charts:

#votes {
  padding: 0;
  list-style-type: none;
  height: 10em;
  width: 10em;
}

Nothing exiting going on here, really.

Pie Chart

First chart we make is the pie chart. This is appropriate as our data represents fractions of a total. Each list item will be drawn as a circle on top of each other, with a colored part that represents the value, and a transparent part that is the rest.

#votes {
  position: relative;
}
#votes > li {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  border-radius: 50%;
  background: conic-gradient(transparent var(--previous-sum), var(--color) var(--previous-sum));
}

The conic background states that up to the previous-sum everything should be transparent; after that everything should have our chosen color. Because the circles are on top of each other they hide the superfluous colored part. We could have made the superfluous part transparent as well, but we don’t really need to. Remember, we are aiming for a simple chart.

Pie chart from HTML list

Bar Chart

For the bar chart we want vertical bars. The bars should start at the bottom, and their heights should match the vote values.

#votes {
  display: flex;
  align-items: end;
}
#votes > li {
  background-color: var(--color);
  height: var(--value);
  width: calc(100% / var(--count));
}

We are using display: flex and align-items: endto put stuff at the bottom of the chart area. The height is set to the value of each element, and the width is set to ‘full width divided by the number of data items’.

Bar chart from HTML list

Point Chart

For the point chart we want to display the points in the middle of the interval. We want them to be round, and we want them to have a decent size.

#votes {
  display: flex;
}
#votes > li {
  border-radius: 100%;
  background-color: lightgray;
  width: calc(20% / var(--count));
  height: calc(20% / var(--count));
  margin: auto auto var(--value) auto;
}

The points are positioned using margin, because in this case that is the simplest solution. The size of the points are calculated from some width divided by the number of data items. Find a nice width by trial-and-error; I found 20% to look nice for my dataset.

To make the point chart more legible we are going to add some horizontal lines. We do that by adding the following:

#votes {
  ... other styling ...
  position: relative;
}
#votes::after {
  content: '';
  height: 100%;
  width: 100%;
  position: absolute;
  background-size: 100% 20%;
  background-image:
    linear-gradient(transparent, transparent),
    linear-gradient(to top, black 1px, transparent 1px);
}

Point chart from HTML list

Filled Line Chart

Next up is the filled line chart. It is a mix of the bar chart and the line chart (the later of which we have not made yet). It is in a way simpler that the line chart, as we will see in a moment.

Different colors in the background is rarely meaningful for this type of chart, so we are just going to give it a uniform light gray.

#votes {
  display: flex;
}
#votes > li {
  background-color: lightgray;
  height: 100%;
  width: calc(100% / var(--count));
  clip-path: polygon(
    0 100%, 
    0 calc(100% - var(--previous-value)), 
    100% calc(100% - var(--value)), 
    100% 100%);
}

This chart draws each list item as a polygon: The top edge is defined by the previous and current values of the data and will be diagonal (unless of course the previous and current values are the same). The rest of the polygon will be rectangular.

The polygon is created by pairs of (x y) coordinates. Since the goram y-coordinate is 0 at the top and 100% at the bottom, we have to do the j100% — <our value> to get the correct y-value.

It may be appropriate here to add the horizontal lines we also used in the point chart.

Filled line chart from HTML list

Line Chart

The line chart is like the filled line chart except on one point: We are not drawing all the way to the bottom of the chart. Instead we are drawing some very thin polygons, so it ends up looking like lines.

#votes {
  display: flex;
}
#votes > li {
  background-color: black;
  height: 100%;
  width: calc(100% / var(--count));
  clip-path: polygon(
    0 calc(100% - var(--previous-value)), 
    100% calc(100% - var(--value)), 
    100% calc(100% - var(--value) + 2px), 
    0 calc(100% - var(--previous-value) + 2px));  
}

Line chart from HTML list

Text Table

Displaying the data as a table using the CSS approach actually requires the most CSS. And, because CSS does not allow changing non-text (such as 35%) to text, we need to use the value-text variable to display the value.

#votes {
  border: solid 1px black;
  height: auto;
}
#votes:before {
  content: 'Votes:';
  display: inline-block;
  width: 9em;
  padding-left: 1em;
}
#votes > li::before, #votes > li::after {
  border-top: solid 1px black;
  display: inline-block;
}
#votes > li::before {
  border-right: none;
  content: var(--label);
  width: 5em;
  padding-left: 1em;
}
#votes > li::after {
  border-left: none;
  content: var(--value-text);
  width: 3em;
  padding-right: 1em;
  text-align: right;
}

Text table from HTML list

Conclusion

Here you have a short list of simple charts that can be achieved with a few lines of HTML and CSS.

There are many other charts that could be made the same way. How about donut charts, stacked line charts, or area charts? What if we want labels displaying the values, or a x- and y-axis? With the examples in this article as inspiration, you should not find it difficult to make your charts completely your own.

If you liked this article, consider following me. Then you will be part of my crew. 

Link: https://betterprogramming.pub/build-a-pie-bar-line-and-point-chart-using-css-799983a6ab3d

#css 

Saul  Alaniz

Saul Alaniz

1643374800

Cree Un Gráfico Circular, De Barras, De Líneas Y De Puntos Usando CSS

¡No es para preocuparse! A menudo, todo lo que necesita hacer es una lista o tabla simple, luego agregue un poco de CSS para transformarla en un gráfico.

Digamos que hicimos una encuesta sobre si hacer o no un reinicio de Firefly con un nuevo elenco. Este podría ser nuestro conjunto de datos:

Sí: 35 %
No: 55 %
En blanco: 10 %;

¡Brillante! Ahora bien, no todos los tipos de gráficos son apropiados para estos datos. Por ejemplo, un gráfico de líneas debería mostrar una serie, no categorías, pero lo haremos de todos modos, solo para demostrar cómo hacerlo.

No entraré en demasiados detalles sobre el CSS, explicando cómo funciona un atributo específico. Úselo tal como está, o ajústelo y, en el proceso, tal vez aprenda un atributo CSS que no conocía antes. También tenga en cuenta que estos son gráficos simples ; si necesita información sobre herramientas, animaciones o funciones avanzadas, entonces una biblioteca de gráficos puede ser más adecuada.

También puede encontrar el código en GitHub .

El marcado

Supongamos que hemos cargado los datos, pero aún no hemos decidido cómo mostrarlos. En lugar de retrasar el proceso, simplemente lo representamos en una lista HTML, lo decoramos con algunas variables CSS que describen los datos y se lo entregamos a los diseñadores.

Estableceremos estas variables CSS:

  • etiqueta : El tipo de voto (Sí, No, En blanco)
  • value : Los porcentajes de cada voto.
  • value-text : El valor como texto.
  • anterior-valor : valor del elemento de datos anterior.
  • anterior-sum : Suma de todos los valores anteriores.
  • recuento : el número de elementos de datos.
  • color : El color deseado.

Los valores de estas variables son fáciles de obtener a partir de los datos. Accedemos a ellos en CSS usandovar(--my-variable)

Si ya sabe qué gráfico va a hacer, probablemente no necesite la lista completa de variables.

Usando nuestro marco favorito o Vanilla JS, creamos un elemento de lista para cada elemento de datos y configuramos las variables como estilos en línea, lo que da como resultado el siguiente marcado:


<ul id="votes" style="--count: 3;">
  <li style="
    --label: 'Yay'; --value: 35%; --value-text: '25%'; 
    --previous-value: 0%; --previous-sum: 0%;
    --color: green;"></li>
  <li style="
    --label: 'Nay'; --value: 55%; --value-text: '55%'; 
    --previous-value: 35%; --previous-sum: 35%;
    --color: red;"></li>
  <li style="
    --label: 'Blank'; --value: 10%; --value-text: '10%'; 
    --previous-value: 55%; --previous-sum: 90%;
    --color: blue;"></li>
</ul>

¡Ahora tenemos algo que podemos diseñar, y eso nos hace poderosos!

Estilo general

Comencemos agregando un estilo básico para eliminar el 'aspecto de lista' y establecer un tamaño general de los gráficos:

#votes {
  padding: 0;
  list-style-type: none;
  height: 10em;
  width: 10em;
}

No pasa nada interesante aquí, de verdad.

Gráfico circular

El primer gráfico que hacemos es el gráfico circular. Esto es apropiado ya que nuestros datos representan fracciones de un total. Cada elemento de la lista se dibujará como un círculo uno encima del otro, con una parte coloreada que representa el valor y una parte transparente que es el resto.

#votes {
  position: relative;
}
#votes > li {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  border-radius: 50%;
  background: conic-gradient(transparent var(--previous-sum), var(--color) var(--previous-sum));
}

El fondo cónico establece que hasta el previous-sumtodo debe ser transparente; después de eso, todo debería tener nuestro color elegido. Debido a que los círculos están uno encima del otro, ocultan la parte de color superflua. Podríamos haber hecho transparente la parte superflua también, pero realmente no es necesario. Recuerde, nuestro objetivo es un gráfico simple.

Gráfico circular de la lista HTML

Gráfico de barras

Para el gráfico de barras queremos barras verticales. Las barras deben comenzar en la parte inferior y sus alturas deben coincidir con los valores de los votos.

#votes {
  display: flex;
  align-items: end;
}
#votes > li {
  background-color: var(--color);
  height: var(--value);
  width: calc(100% / var(--count));
}

Estamos usando display: flexy align-items: endpara poner cosas en la parte inferior del área del gráfico. La altura se establece en el valor de cada elemento y el ancho se establece en 'ancho completo dividido por el número de elementos de datos'.

Gráfico de barras de la lista HTML

Gráfico de puntos

Para el gráfico de puntos, queremos mostrar los puntos en el medio del intervalo. Queremos que sean redondos y queremos que tengan un tamaño decente.

#votes {
  display: flex;
}
#votes > li {
  border-radius: 100%;
  background-color: lightgray;
  width: calc(20% / var(--count));
  height: calc(20% / var(--count));
  margin: auto auto var(--value) auto;
}

Los puntos se posicionan usando margin, porque en este caso esa es la solución más simple. El tamaño de los puntos se calcula a partir de un ancho dividido por el número de elementos de datos. Encuentre un buen ancho por prueba y error; Encontré que el 20% se ve bien para mi conjunto de datos.

Para que el gráfico de puntos sea más legible, vamos a agregar algunas líneas horizontales. Lo hacemos agregando lo siguiente:

#votes {
  ... other styling ...
  position: relative;
}
#votes::after {
  content: '';
  height: 100%;
  width: 100%;
  position: absolute;
  background-size: 100% 20%;
  background-image:
    linear-gradient(transparent, transparent),
    linear-gradient(to top, black 1px, transparent 1px);
}

Gráfico de puntos de la lista HTML

Gráfico de líneas rellenas

El siguiente es el gráfico de líneas rellenas. Es una mezcla del gráfico de barras y el gráfico de líneas (el último de los cuales aún no hemos hecho). Es en cierto modo más sencillo que el gráfico de líneas, como veremos en un momento.

Los diferentes colores en el fondo rara vez son significativos para este tipo de gráfico, por lo que solo le daremos un gris claro uniforme.

#votes {
  display: flex;
}
#votes > li {
  background-color: lightgray;
  height: 100%;
  width: calc(100% / var(--count));
  clip-path: polygon(
    0 100%, 
    0 calc(100% - var(--previous-value)), 
    100% calc(100% - var(--value)), 
    100% 100%);
}

Este gráfico dibuja cada elemento de la lista como un polígono: el borde superior está definido por los valores anteriores y actuales de los datos y será diagonal (a menos, por supuesto, que los valores anteriores y actuales sean los mismos). El resto del polígono será rectangular.

El polígono se crea mediante pares de coordenadas (xy). Dado que la coordenada goram y es 0 en la parte superior y 100% en la parte inferior, tenemos que hacer j100% — <our value>para obtener el valor y correcto.

Puede ser apropiado aquí agregar las líneas horizontales que también usamos en el gráfico de puntos.

Gráfico de líneas rellenas de la lista HTML

Gráfico de linea

El gráfico de líneas es como el gráfico de líneas rellenas excepto en un punto: no estamos dibujando hasta el final del gráfico. En cambio, estamos dibujando algunos polígonos muy delgados, por lo que termina pareciendo líneas.

#votes {
  display: flex;
}
#votes > li {
  background-color: black;
  height: 100%;
  width: calc(100% / var(--count));
  clip-path: polygon(
    0 calc(100% - var(--previous-value)), 
    100% calc(100% - var(--value)), 
    100% calc(100% - var(--value) + 2px), 
    0 calc(100% - var(--previous-value) + 2px));  
}

Gráfico de líneas de la lista HTML

Tabla de texto

Mostrar los datos como una tabla utilizando el enfoque de CSS en realidad requiere la mayor cantidad de CSS. Y, debido a que CSS no permite cambiar lo que no es texto (como el 35 %) a texto, necesitamos usar la value-textvariable para mostrar el valor.

#votes {
  border: solid 1px black;
  height: auto;
}
#votes:before {
  content: 'Votes:';
  display: inline-block;
  width: 9em;
  padding-left: 1em;
}
#votes > li::before, #votes > li::after {
  border-top: solid 1px black;
  display: inline-block;
}
#votes > li::before {
  border-right: none;
  content: var(--label);
  width: 5em;
  padding-left: 1em;
}
#votes > li::after {
  border-left: none;
  content: var(--value-text);
  width: 3em;
  padding-right: 1em;
  text-align: right;
}

Tabla de texto de la lista HTML

Conclusión

Aquí tienes una breve lista de gráficos simples que se pueden lograr con unas pocas líneas de HTML y CSS.

Hay muchos otros gráficos que podrían hacerse de la misma manera. ¿Qué hay de los gráficos de anillos, los gráficos de líneas apiladas o los gráficos de áreas? ¿Qué pasa si queremos etiquetas que muestren los valores, o un eje x e y? Con los ejemplos de este artículo como inspiración, no debería resultarle difícil hacer sus gráficos completamente suyos.

Si te ha gustado este artículo, considera seguirme. Entonces serás parte de mi equipo. 

Enlace: https://betterprogramming.pub/build-a-pie-bar-line-and-point-chart-using-css-799983a6ab3d

#css 

山本  洋介

山本 洋介

1643605200

CSSを使用して円、棒、線、および点のグラフを作成する

心配無用!多くの場合、作成する必要があるのは単純なリストまたはテーブルだけです。次に、CSSを少し追加してチャートに変換します。

新しいキャストでFireflyの再起動を行うかどうかについて投票を行ったとしましょう。これは私たちのデータセットである可能性があります:

イェーイ:35%イェーイ:
55%
空白:10%;

ピカピカ!現在、すべてのグラフタイプがこれらのデータに適しているわけではありません。折れ線グラフは、たとえば、カテゴリではなくシリーズを表示する必要がありますが、それを行う方法を示すために、とにかくそれを行います。

CSSについてはあまり詳しく説明せず、特定の属性がどのように機能するかを説明します。そのまま使用するか、調整して、その過程で、これまで知らなかったCSS属性を学習する可能性があります。また、これらは単純なチャートであることに注意してください。ツールチップ、アニメーション、または高度な機能が必要な場合は、チャートライブラリの方が適している場合があります。

コードはGitHubにもあります。

マークアップ

データをロードしたと仮定しますが、データの表示方法はまだ決定していません。プロセスを遅らせる代わりに、HTMLリストでレンダリングし、データを説明するいくつかのCSS変数で装飾して、デザイナーに渡します。

これらのCSS変数を設定します。

  • ラベル:投票の種類(Yay、Nay、Blank)
  • :各投票のパーセンテージ。
  • value-text:テキストとしての値。
  • previous-value:前のデータ項目の値。
  • previous-sum:以前のすべての値の合計。
  • count:データ項目の数。
  • :希望の色。

これらの変数の値は、データから簡単に取得できます。CSSを使用してそれらにアクセスしますvar(--my-variable)

作成するチャートがすでにわかっている場合は、変数の完全なリストはおそらく必要ありません。

お気に入りのフレームワークまたはバニラJSを使用して、データ項目ごとにリスト項目を作成し、変数をインラインスタイルとして設定して、次のマークアップを作成します。


<ul id="votes" style="--count: 3;">
  <li style="
    --label: 'Yay'; --value: 35%; --value-text: '25%'; 
    --previous-value: 0%; --previous-sum: 0%;
    --color: green;"></li>
  <li style="
    --label: 'Nay'; --value: 55%; --value-text: '55%'; 
    --previous-value: 35%; --previous-sum: 35%;
    --color: red;"></li>
  <li style="
    --label: 'Blank'; --value: 10%; --value-text: '10%'; 
    --previous-value: 55%; --previous-sum: 90%;
    --color: blue;"></li>
</ul>

私たちは今、私たちがスタイリングできるものを手に入れました、そしてそれは私たちを強力にします!

全体的なスタイリング

基本的なスタイルを追加して「list-look」を削除し、グラフの全体的なサイズを設定することから始めましょう。

#votes {
  padding: 0;
  list-style-type: none;
  height: 10em;
  width: 10em;
}

本当に、ここで何も起こっていません。

円グラフ

最初に作成するグラフは円グラフです。私たちのデータは全体の一部を表しているので、これは適切です。各リストアイテムは、値を表す色付きの部分と残りの部分である透明な部分で、互いの上に円として描画されます。

#votes {
  position: relative;
}
#votes > li {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  border-radius: 50%;
  background: conic-gradient(transparent var(--previous-sum), var(--color) var(--previous-sum));
}

円錐曲線の背景には、previous-sumすべてが透明である必要があると記載されています。その後、すべてが選択した色になるはずです。円は互いに重なり合っているため、余分な色の部分を隠します。余分な部分も透明にすることもできますが、そうする必要はありません。シンプルなチャートを目指していることを忘れないでください。

HTMLリストからの円グラフ

棒グラフ

棒グラフには、縦棒が必要です。バーは下部から開始し、高さは投票値と一致する必要があります。

#votes {
  display: flex;
  align-items: end;
}
#votes > li {
  background-color: var(--color);
  height: var(--value);
  width: calc(100% / var(--count));
}

チャート領域の下部にあるものを使用display: flexして配置しています。align-items: end高さは各要素の値に設定され、幅は「全幅をデータ項目の数で割った値」に設定されます。

HTMLリストの棒グラフ

ポイントチャート

ポイントチャートでは、間隔の中央にポイントを表示します。私たちはそれらを丸くしたい、そして私たちはそれらがまともなサイズを持っていることを望んでいます。

#votes {
  display: flex;
}
#votes > li {
  border-radius: 100%;
  background-color: lightgray;
  width: calc(20% / var(--count));
  height: calc(20% / var(--count));
  margin: auto auto var(--value) auto;
}

marginこの場合、これが最も簡単な解決策であるため、ポイントはを使用して配置されます。ポイントのサイズは、ある幅をデータ項目の数で割って計算されます。試行錯誤で適切な幅を見つけます。20%が自分のデータセットに適していることがわかりました。

ポイントチャートを読みやすくするために、いくつかの水平線を追加します。これを行うには、次を追加します。

#votes {
  ... other styling ...
  position: relative;
}
#votes::after {
  content: '';
  height: 100%;
  width: 100%;
  position: absolute;
  background-size: 100% 20%;
  background-image:
    linear-gradient(transparent, transparent),
    linear-gradient(to top, black 1px, transparent 1px);
}

HTMLリストからのポイントチャート

塗りつぶされた折れ線グラフ

次は、塗りつぶされた折れ線グラフです。これは、棒グラフと折れ線グラフを組み合わせたものです(後者はまだ作成していません)。すぐにわかるように、折れ線グラフよりも簡単です。

このタイプのグラフでは、背景の色が異なることはめったに意味がないため、均一なライトグレーを使用します。

#votes {
  display: flex;
}
#votes > li {
  background-color: lightgray;
  height: 100%;
  width: calc(100% / var(--count));
  clip-path: polygon(
    0 100%, 
    0 calc(100% - var(--previous-value)), 
    100% calc(100% - var(--value)), 
    100% 100%);
}

このグラフは、各リストアイテムをポリゴンとして描画します。上端は、データの以前の値と現在の値によって定義され、対角線になります(もちろん、以前の値と現在の値が同じでない場合)。ポリゴンの残りの部分は長方形になります。

ポリゴンは、(xy)座標のペアによって作成されます。ゴラムのy座標は、上部が0、下部が100%であるj100% — <our value>ため、正しいy値を取得するためにを実行する必要があります。

ここで、ポイントチャートでも使用した水平線を追加するのが適切な場合があります。

HTMLリストからの塗りつぶされた折れ線グラフ

折れ線グラフ

折れ線グラフは、1つの点を除いて、塗りつぶされた折れ線グラフに似ています。グラフの一番下まで描画していません。代わりに、非常に細いポリゴンを描画しているため、線のように見えます。

#votes {
  display: flex;
}
#votes > li {
  background-color: black;
  height: 100%;
  width: calc(100% / var(--count));
  clip-path: polygon(
    0 calc(100% - var(--previous-value)), 
    100% calc(100% - var(--value)), 
    100% calc(100% - var(--value) + 2px), 
    0 calc(100% - var(--previous-value) + 2px));  
}

HTMLリストからの折れ線グラフ

テキストテーブル

CSSアプローチを使用してデータをテーブルとして表示するには、実際にはほとんどのCSSが必要です。また、CSSでは非テキスト(35%など)をテキストに変更できないため、value-text変数を使用して値を表示する必要があります。

#votes {
  border: solid 1px black;
  height: auto;
}
#votes:before {
  content: 'Votes:';
  display: inline-block;
  width: 9em;
  padding-left: 1em;
}
#votes > li::before, #votes > li::after {
  border-top: solid 1px black;
  display: inline-block;
}
#votes > li::before {
  border-right: none;
  content: var(--label);
  width: 5em;
  padding-left: 1em;
}
#votes > li::after {
  border-left: none;
  content: var(--value-text);
  width: 3em;
  padding-right: 1em;
  text-align: right;
}

HTMLリストからのテキストテーブル

結論

ここに、数行のHTMLとCSSで実現できる簡単なグラフの短いリストがあります。

同じ方法で作成できるチャートは他にもたくさんあります。ドーナツチャート、積み上げ折れ線グラフ、または面グラフはどうですか?値、またはx軸とy軸を表示するラベルが必要な場合はどうなりますか?この記事の例を参考にして、チャートを完全に独自のものにするのは難しいことではありません。

この記事が気に入ったら、私をフォローすることを検討してください。その後、あなたは私の乗組員の一部になります。 

リンク:https ://betterprogramming.pub/build-a-pie-bar-line-and-point-chart-using-css-799983a6ab3d

#css 

Easter  Deckow

Easter Deckow

1655630160

PyTumblr: A Python Tumblr API v2 Client

PyTumblr

Installation

Install via pip:

$ pip install pytumblr

Install from source:

$ git clone https://github.com/tumblr/pytumblr.git
$ cd pytumblr
$ python setup.py install

Usage

Create a client

A pytumblr.TumblrRestClient is the object you'll make all of your calls to the Tumblr API through. Creating one is this easy:

client = pytumblr.TumblrRestClient(
    '<consumer_key>',
    '<consumer_secret>',
    '<oauth_token>',
    '<oauth_secret>',
)

client.info() # Grabs the current user information

Two easy ways to get your credentials to are:

  1. The built-in interactive_console.py tool (if you already have a consumer key & secret)
  2. The Tumblr API console at https://api.tumblr.com/console
  3. Get sample login code at https://api.tumblr.com/console/calls/user/info

Supported Methods

User Methods

client.info() # get information about the authenticating user
client.dashboard() # get the dashboard for the authenticating user
client.likes() # get the likes for the authenticating user
client.following() # get the blogs followed by the authenticating user

client.follow('codingjester.tumblr.com') # follow a blog
client.unfollow('codingjester.tumblr.com') # unfollow a blog

client.like(id, reblogkey) # like a post
client.unlike(id, reblogkey) # unlike a post

Blog Methods

client.blog_info(blogName) # get information about a blog
client.posts(blogName, **params) # get posts for a blog
client.avatar(blogName) # get the avatar for a blog
client.blog_likes(blogName) # get the likes on a blog
client.followers(blogName) # get the followers of a blog
client.blog_following(blogName) # get the publicly exposed blogs that [blogName] follows
client.queue(blogName) # get the queue for a given blog
client.submission(blogName) # get the submissions for a given blog

Post Methods

Creating posts

PyTumblr lets you create all of the various types that Tumblr supports. When using these types there are a few defaults that are able to be used with any post type.

The default supported types are described below.

  • state - a string, the state of the post. Supported types are published, draft, queue, private
  • tags - a list, a list of strings that you want tagged on the post. eg: ["testing", "magic", "1"]
  • tweet - a string, the string of the customized tweet you want. eg: "Man I love my mega awesome post!"
  • date - a string, the customized GMT that you want
  • format - a string, the format that your post is in. Support types are html or markdown
  • slug - a string, the slug for the url of the post you want

We'll show examples throughout of these default examples while showcasing all the specific post types.

Creating a photo post

Creating a photo post supports a bunch of different options plus the described default options * caption - a string, the user supplied caption * link - a string, the "click-through" url for the photo * source - a string, the url for the photo you want to use (use this or the data parameter) * data - a list or string, a list of filepaths or a single file path for multipart file upload

#Creates a photo post using a source URL
client.create_photo(blogName, state="published", tags=["testing", "ok"],
                    source="https://68.media.tumblr.com/b965fbb2e501610a29d80ffb6fb3e1ad/tumblr_n55vdeTse11rn1906o1_500.jpg")

#Creates a photo post using a local filepath
client.create_photo(blogName, state="queue", tags=["testing", "ok"],
                    tweet="Woah this is an incredible sweet post [URL]",
                    data="/Users/johnb/path/to/my/image.jpg")

#Creates a photoset post using several local filepaths
client.create_photo(blogName, state="draft", tags=["jb is cool"], format="markdown",
                    data=["/Users/johnb/path/to/my/image.jpg", "/Users/johnb/Pictures/kittens.jpg"],
                    caption="## Mega sweet kittens")

Creating a text post

Creating a text post supports the same options as default and just a two other parameters * title - a string, the optional title for the post. Supports markdown or html * body - a string, the body of the of the post. Supports markdown or html

#Creating a text post
client.create_text(blogName, state="published", slug="testing-text-posts", title="Testing", body="testing1 2 3 4")

Creating a quote post

Creating a quote post supports the same options as default and two other parameter * quote - a string, the full text of the qote. Supports markdown or html * source - a string, the cited source. HTML supported

#Creating a quote post
client.create_quote(blogName, state="queue", quote="I am the Walrus", source="Ringo")

Creating a link post

  • title - a string, the title of post that you want. Supports HTML entities.
  • url - a string, the url that you want to create a link post for.
  • description - a string, the desciption of the link that you have
#Create a link post
client.create_link(blogName, title="I like to search things, you should too.", url="https://duckduckgo.com",
                   description="Search is pretty cool when a duck does it.")

Creating a chat post

Creating a chat post supports the same options as default and two other parameters * title - a string, the title of the chat post * conversation - a string, the text of the conversation/chat, with diablog labels (no html)

#Create a chat post
chat = """John: Testing can be fun!
Renee: Testing is tedious and so are you.
John: Aw.
"""
client.create_chat(blogName, title="Renee just doesn't understand.", conversation=chat, tags=["renee", "testing"])

Creating an audio post

Creating an audio post allows for all default options and a has 3 other parameters. The only thing to keep in mind while dealing with audio posts is to make sure that you use the external_url parameter or data. You cannot use both at the same time. * caption - a string, the caption for your post * external_url - a string, the url of the site that hosts the audio file * data - a string, the filepath of the audio file you want to upload to Tumblr

#Creating an audio file
client.create_audio(blogName, caption="Rock out.", data="/Users/johnb/Music/my/new/sweet/album.mp3")

#lets use soundcloud!
client.create_audio(blogName, caption="Mega rock out.", external_url="https://soundcloud.com/skrillex/sets/recess")

Creating a video post

Creating a video post allows for all default options and has three other options. Like the other post types, it has some restrictions. You cannot use the embed and data parameters at the same time. * caption - a string, the caption for your post * embed - a string, the HTML embed code for the video * data - a string, the path of the file you want to upload

#Creating an upload from YouTube
client.create_video(blogName, caption="Jon Snow. Mega ridiculous sword.",
                    embed="http://www.youtube.com/watch?v=40pUYLacrj4")

#Creating a video post from local file
client.create_video(blogName, caption="testing", data="/Users/johnb/testing/ok/blah.mov")

Editing a post

Updating a post requires you knowing what type a post you're updating. You'll be able to supply to the post any of the options given above for updates.

client.edit_post(blogName, id=post_id, type="text", title="Updated")
client.edit_post(blogName, id=post_id, type="photo", data="/Users/johnb/mega/awesome.jpg")

Reblogging a Post

Reblogging a post just requires knowing the post id and the reblog key, which is supplied in the JSON of any post object.

client.reblog(blogName, id=125356, reblog_key="reblog_key")

Deleting a post

Deleting just requires that you own the post and have the post id

client.delete_post(blogName, 123456) # Deletes your post :(

A note on tags: When passing tags, as params, please pass them as a list (not a comma-separated string):

client.create_text(blogName, tags=['hello', 'world'], ...)

Getting notes for a post

In order to get the notes for a post, you need to have the post id and the blog that it is on.

data = client.notes(blogName, id='123456')

The results include a timestamp you can use to make future calls.

data = client.notes(blogName, id='123456', before_timestamp=data["_links"]["next"]["query_params"]["before_timestamp"])

Tagged Methods

# get posts with a given tag
client.tagged(tag, **params)

Using the interactive console

This client comes with a nice interactive console to run you through the OAuth process, grab your tokens (and store them for future use).

You'll need pyyaml installed to run it, but then it's just:

$ python interactive-console.py

and away you go! Tokens are stored in ~/.tumblr and are also shared by other Tumblr API clients like the Ruby client.

Running tests

The tests (and coverage reports) are run with nose, like this:

python setup.py test

Author: tumblr
Source Code: https://github.com/tumblr/pytumblr
License: Apache-2.0 license

#python #api 

Harry Patel

Harry Patel

1614145832

A Complete Process to Create an App in 2021

It’s 2021, everything is getting replaced by a technologically emerged ecosystem, and mobile apps are one of the best examples to convey this message.

Though bypassing times, the development structure of mobile app has also been changed, but if you still follow the same process to create a mobile app for your business, then you are losing a ton of opportunities by not giving top-notch mobile experience to your users, which your competitors are doing.

You are about to lose potential existing customers you have, so what’s the ideal solution to build a successful mobile app in 2021?

This article will discuss how to build a mobile app in 2021 to help out many small businesses, startups & entrepreneurs by simplifying the mobile app development process for their business.

The first thing is to EVALUATE your mobile app IDEA means how your mobile app will change your target audience’s life and why your mobile app only can be the solution to their problem.

Now you have proposed a solution to a specific audience group, now start to think about the mobile app functionalities, the features would be in it, and simple to understand user interface with impressive UI designs.

From designing to development, everything is covered at this point; now, focus on a prelaunch marketing plan to create hype for your mobile app’s targeted audience, which will help you score initial downloads.

Boom, you are about to cross a particular download to generate a specific revenue through your mobile app.

#create an app in 2021 #process to create an app in 2021 #a complete process to create an app in 2021 #complete process to create an app in 2021 #process to create an app #complete process to create an app