Giter Site home page Giter Site logo

item-explorer's Introduction

Item explorer

Exploring combinatorial questions with a bar chart. There are many applications with combinatorial questions such as discovering frequent combinations of items bought in a store (market basket analysis) or exploring what web pages do users visit on a certain web site. Item explorer is build using the d3-template which implements the reusable charts pattern to let you customize the chart.

Here is a link to a video explaining how to use item explorer with your own data and here is a web site introducing item explorer.

Examples

The main example is here.

Complete list of examples:

  1. Data formatting
  1. Including data
  1. Visualization options

1. Data formatting

The file must be a comma separated file with the first row containing the attribute names. The attribute refering to the frequency has to be preceded with a _(underscore). The name following the underscore is displayed as the label for the y axis. Note that the attribute names must be distinct, otherwise an error occurs. All other rows contain a comma separated list of the frequency and 0's or 1's for each attribute depending on if it applies or not.

Column features

Features can be added to the attributes in the first line of the csv file. Multiple features per attribute are possible. Features are specified after the corresponding attribute separated by a :(colon).

Supported column features:
  • CO= for specifying a color in rgb. E.g: CO=rgb(70 130 180). Color can be used to denote certain items belonging together.
  • LN= for specifying a long name of an item. E.g: LN=myLongItemName.
  • DI= for specifying a dimension. E.g: DI=fruits. Dimensions can be specified when certain items have a different meaning hence belonging to different dimensions. Different dimensions are drawn in separate bar charts and sorted separately.

Example of a csv file with column features:

_customers,item1:LN=longitem1,item2:LN=longitem2,item3:LN=longitem3,item4
1378,1,0,0,0
6352,0,1,0,0
435,1,1,1,0
...

2. Including data

If a csv file with data in the correct format exists, the typical call of item explorer looks as follows:

    ...
    // include the following three files:
    <link rel="stylesheet" type="text/css" href="https://www.ankerst.de/lib/itemExplorer_10.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
    <script src="https://www.ankerst.de/lib/itemExplorer_10.min.js"></script>
    ...
    // setup a chart with a csv file and add the visualization to a DOM element
    var myIEChart = itemExplorerChart("items.csv");
    showChart(); 
    
    function showChart() {
      d3.select("body")
        .append("div")
        .attr("class", "chart")
        .call(myIEChart);
    }  

3. Visualization options

function explanation
barWidth() sets the width of each bar in pixels. The default value is 38.
barHeight() sets the maximum height of the bars in pixels. The default value is 340.
thousandsSeparator() sets the thousands separator and will be applied to the y axis, the info and exploration panels and the tooltip. The default value is "," (e.g. leading to 1,000) with the decimal separator being ".". The only other choice is "." (e.g. leading to 1.000) leading to the decimal separator ",".
tickFormat() sets the tick format for the y axis. The default value is ",.0f".
drawGridLines() draws the grid lines. The default value is true.

item-explorer's People

Contributors

ee2dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.