Currently there may be errors shown on top of a page, because of a missing Wiki update (PHP version and extension DPL3).
Navigation
Topics Help • Register • News • History • How to • Sequences statistics • Template prototypes

Difference between revisions of "Main Page"

From Prime-Wiki
Jump to: navigation, search
(graphs examples)
Line 122: Line 122:
 
Display with image handler:
 
Display with image handler:
 
[[File:Mersenne.csv|legend_title=Mersenne primes,x_type=no,x_title= ,x_unit=No.,y_type=no,y_title= ,y_unit=n value]]
 
[[File:Mersenne.csv|legend_title=Mersenne primes,x_type=no,x_title= ,x_unit=No.,y_type=no,y_title= ,y_unit=n value]]
 +
}}
 +
 +
{{Box|hide=false|title=Examples for graphs extension|content=
 +
Using template [[:Template:PieChart|PieChart]]:
 +
{{PieChart|legend=Fruits|radius=125|values= [
 +
      {"x": "Peaches","y": 100},
 +
      {"x": "Plums","y": 32},
 +
      {"x": "Blueberries","y": 80},
 +
      {"x": "Strawberries","y": 46},
 +
      {"x": "Bananas","y": 41}
 +
    ]
 +
}}
 +
{{PieChart|legend=Fruits|radius=125|rangeliteral= ["red", "green","red","green","red","green","red","green","red","green"] |values= [
 +
      {"x": "perziken","y": 10},
 +
      {"x": "pruimen","y": 10},
 +
      {"x": "bessen","y": 10},
 +
      {"x": "aardbeien","y": 10},
 +
      {"x": "bananen","y": 10},
 +
      {"x": "peach","y": 10},
 +
      {"x": "plum","y": 10},
 +
      {"x": "blueberries","y": 10},
 +
      {"x": "strawberries","y": 10},
 +
      {"x": "bananas","y": 10}
 +
    ]
 +
}}
 +
 +
Using <nowiki><graph></nowiki>-tag directly:
 +
<graph>{
 +
  "version": 2,
 +
  "height": 160,
 +
  "width": 160,
 +
  "legends": [{"title": "Fruits","fill": "color"}],
 +
  "padding": "auto",
 +
  "data": [
 +
    {
 +
      "name": "table",
 +
      "values": [
 +
        {"x": "peach","y": 100,"z": 2},
 +
        {"x": "plums","y": 32,"z": 4},
 +
        {"x": "bluebe","y": 180,"z": 3},
 +
        {"x": "strawb","y": 46,"z": 7},
 +
        {"x": "banan","y": 21,"z": 5}
 +
      ]
 +
    }
 +
  ],
 +
  "scales": [
 +
    {
 +
      "name": "color",
 +
      "range": "category20",
 +
      "domain": {"data": "table","field": "x"},
 +
      "type": "ordinal"
 +
    }
 +
  ],
 +
  "marks": [
 +
    {
 +
      "type": "arc",
 +
      "from": {
 +
        "data": "table",
 +
        "transform": [{"field": "y","type": "pie"}]
 +
      },
 +
      "properties": {
 +
        "enter": {
 +
          "innerRadius": {"value": 100},
 +
          "stroke": {"value": "white"},
 +
          "startAngle": {"field": "layout_start"},
 +
          "outerRadius": {"value": 150},
 +
          "endAngle": {"field": "layout_end"},
 +
          "fill": {"field": "x","scale": "color"}
 +
        }
 +
      }
 +
    },
 +
    {
 +
      "type": "arc",
 +
      "from": {
 +
        "data": "table",
 +
        "transform": [{"field": "z","type": "pie"}]
 +
      },
 +
      "properties": {
 +
        "enter": {
 +
          "innerRadius": {"value": 40},
 +
          "stroke": {"value": "white"},
 +
          "startAngle": {"field": "layout_start"},
 +
          "outerRadius": {"value": 90},
 +
          "endAngle": {"field": "layout_end"},
 +
          "fill": {"field": "x","scale": "color"}
 +
        }
 +
      }
 +
    }
 +
  ]
 +
}</graph>
 +
 +
<graph>{
 +
  "version": 2,
 +
  "width": 150,
 +
  "height": 150,
 +
  "legends": [{"title": "Fruits","fill": "color"}],
 +
  "data": [
 +
{
 +
  "name": "table",
 +
  "values": [
 +
    {"year": "2010","category": "Berries","value": 10},
 +
    {"year": "2010","category": "Plums","value": 12},
 +
    {"year": "2010","category": "Oranges","value": 3},
 +
    {"year": "2010","category": "Apples","value": 7},
 +
    {"year": "2015","category": "Berries","value": 8},
 +
    {"year": "2015","category": "Plums","value": 4},
 +
    {"year": "2015","category": "Oranges","value": 5},
 +
    {"year": "2015","category": "Apples","value": 9}
 +
  ]
 +
}
 +
  ],
 +
  "scales": [
 +
{
 +
  "name": "radius",
 +
  "type": "ordinal",
 +
  "domain": {"data": "table","field": "year"},
 +
  "range": "height"
 +
},
 +
{
 +
  "name": "color",
 +
  "range": "category20",
 +
  "domain": {"data": "table","field": "category"},
 +
  "type": "ordinal"
 +
}
 +
  ],
 +
  "marks": [
 +
{
 +
  "type": "group",
 +
  "from": {
 +
    "data": "table",
 +
    "transform": [{"type": "facet","groupby": ["year"]}]
 +
  },
 +
  "marks": [
 +
    {
 +
      "name": "stacked pie",
 +
      "type": "arc",
 +
      "from": {"transform": [{"field": "value","type": "pie"}]},
 +
      "properties": {
 +
        "enter": {
 +
          "innerRadius": {
 +
            "scale": "radius",
 +
            "field": "year",
 +
            "offset": 25
 +
          },
 +
          "stroke": {"value": "white"},
 +
          "startAngle": {"field": "layout_start"},
 +
          "outerRadius": {
 +
            "scale": "radius",
 +
            "field": "year",
 +
            "offset": 75
 +
          },
 +
          "endAngle": {"field": "layout_end"},
 +
          "fill": {"field": "category","scale": "color"}
 +
        }
 +
      }
 +
    },
 +
    {
 +
      "type": "text",
 +
      "properties": {
 +
        "enter": {
 +
          "radius": {
 +
            "scale": "radius",
 +
            "field": "year",
 +
            "offset": 30
 +
          },
 +
          "theta": {"value":1.2},
 +
          "x": 100,
 +
          "y": 100,
 +
          "text": {"field": "year"},
 +
          "fill": {"value": "#eec"},
 +
          "fontSize": {"value": 18}
 +
        }
 +
      }
 +
    }
 +
  ]
 +
}
 +
  ]
 +
}</graph>
 +
 +
<graph>
 +
{
 +
  "version": 2, "width": 400, "height": 200,
 +
  "padding": {"top": 10, "left": 30, "bottom": 30, "right": 10},
 +
  "data": [
 +
    {
 +
      "name": "table",
 +
      "values": [
 +
        {"x": 1,  "y": 28}, {"x": 2,  "y": 55},
 +
        {"x": 3,  "y": 43}, {"x": 4,  "y": 91},
 +
        {"x": 5,  "y": 81}, {"x": 6,  "y": 53},
 +
        {"x": 7,  "y": 19}, {"x": 8,  "y": 87},
 +
        {"x": 9,  "y": 52}, {"x": 10, "y": 48},
 +
        {"x": 11, "y": 24}, {"x": 12, "y": 49},
 +
        {"x": 13, "y": 87}, {"x": 14, "y": 66},
 +
        {"x": 15, "y": 17}, {"x": 16, "y": 27},
 +
        {"x": 17, "y": 68}, {"x": 18, "y": 16},
 +
        {"x": 19, "y": 49}, {"x": 20, "y": 15}
 +
      ]
 +
    }
 +
  ],
 +
  "scales": [
 +
    {
 +
      "name": "x",
 +
      "type": "ordinal",
 +
      "range": "width",
 +
      "domain": {"data": "table", "field": "x"}
 +
    },
 +
    {
 +
      "name": "y",
 +
      "range": "height",
 +
      "nice": true,
 +
      "domain": {"data": "table", "field": "y"}
 +
    }
 +
  ],
 +
  "axes": [
 +
    {"type": "x", "scale": "x"},
 +
    {"type": "y", "scale": "y"}
 +
  ],
 +
  "marks": [
 +
    {
 +
      "type": "rect",
 +
      "from": {"data": "table"},
 +
      "properties": {
 +
        "enter": {
 +
          "x": {"scale": "x", "field": "x"},
 +
          "width": {"scale": "x", "band": true, "offset": -1},
 +
          "y": {"scale": "y", "field": "y"},
 +
          "y2": {"scale": "y", "value": 0}
 +
        },
 +
        "update": {
 +
          "fill": {"value": "steelblue"}
 +
        },
 +
        "hover": {
 +
          "fill": {"value": "red"}
 +
        }
 +
      }
 +
    }
 +
  ]
 +
}</graph>
 +
 +
 +
Some other demo graphs are shown [https://www.mediawiki.org/wiki/Extension:Graph/Demo here].
 
}}
 
}}

Revision as of 20:33, 2 January 2019

Language: English  • Deutsch
Here is a Wiki for primes and related topics, still under construction.


Expand
Examples in math (LaTeX) notation
Expand
Example of page categorizations
Expand
Example of prime sequence and reservation
Expand
Configuration tests: external links open in new browser tab/window
Expand
Examples of template usage and data table generating
Expand
Examples for including PDF documents
Expand
Example for fetching data from RieselPrime database
Expand
Examples for showing images of external pages
Example for SVG support

Test file, original size 580x400 pixel: Test.svg

Test file,size 80 pixel in width: Test.svg

Clicking on the image will lead to the saved file.
Examples for graphs from CSV file

Display with parser function:

Display with image handler:

Examples for graphs extension

Using template PieChart:

Using <graph>-tag directly:


Some other demo graphs are shown here.