Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/lauragarrison87/metaphorTool
22 August 2024, 06:48:53 UTC
  • Code
  • Branches (2)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/heads/transitionFix
    No releases to show
  • 3f0c360
  • /
  • exploratoryTool
  • /
  • bar.js
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:9b208a6fc386d44aa79f26ff080c79aa7465c7c6
origin badgedirectory badge
swh:1:dir:706feb4b81d83bb03d0b0dba3d7be745469c5b8f
origin badgerevision badge
swh:1:rev:51d6271b2d39873d8144b61db9ff8fb5e9031abb
origin badgesnapshot badge
swh:1:snp:9837fefdf0840d8759ea320718c6c595b228ae53

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 51d6271b2d39873d8144b61db9ff8fb5e9031abb authored by Enterausernamenotavailable on 14 August 2024, 10:48:32 UTC
Update README.md
Tip revision: 51d6271
bar.js
// Set dimensions 
const widthBar = 200

let dimensionsBar = {
    width: widthBar,
    height: widthBar * 0.7,
    margin: {
        top: 10, 
        right: 10,
        bottom: 30,
        left: 25,
    },
}

dimensionsBar.boundedWidth = dimensionsBar.width
    - dimensionsBar.margin.left
    - dimensionsBar.margin.right

dimensionsBar.boundedHeight = dimensionsBar.height
    - dimensionsBar.margin.top
    - dimensionsBar.margin.bottom


// const xAccessorStruct = d => d.structural
// const xAccessorOnto = d => d.ontological
// const xAccessorOrient = d => d.orientational
// const xAccessorImag = d => d.imagistic

const cmts = [
    "Str", 
    "Ont",
    "Ori",
    "Img",
]

const barColors = d3.scaleOrdinal([
    "#D7191D",
    "#FDAE61",
    "#ABDDA4",
    "#2A83BA"
])

// const xAccessorStruct = d => parseFloat(d.cnt_structural)
// const xAccessorOnto = d => parseFloat(d.cnt_ontological)
// const xAccessorOrient = d => parseFloat(d.cnt_orientational)
// const xAccessorImag = d => parseFloat(d.cnt_imagistic)

// Create scales 
const yScaleBar = d3.scaleBand()
    .domain(cmts)
    .range([0, dimensionsBar.boundedHeight])
    .padding(0.2)

const xScaleBar = d3.scaleLinear()
    .domain([0,5]) //consistent y-scaling
    .range([0, dimensionsBar.boundedWidth])

const xAxisGeneratorBar = d3.axisBottom()
    .ticks(5)
    .scale(xScaleBar)

const yAxisGeneratorBar = d3.axisLeft()
    .scale(yScaleBar)


async function drawBarPlot() {

    // Initial draw canvas 
    const barWrapper = d3.select("#barplot")
        .append("svg")
        .attr("width", dimensionsBar.width)
        .attr("height", dimensionsBar.height)
    
    const barBounds = barWrapper.append("g")
        .attr("id", "bar-bounds") 
        .style("transform", `translate(${
            dimensionsBar.margin.left
        }px, ${
            dimensionsBar.margin.top
        }px)`)
    
    const yAxis = barBounds.append("g")
        .call(yAxisGeneratorBar)
        .attr("class", "barYaxis")

    const xAxis = barBounds.append("g")
        .call(xAxisGeneratorBar)
        .attr("class", "barXaxis")
        .style("transform", `translateY(${dimensionsBar.boundedHeight}px)`)
    
    const bars = barBounds.selectAll("rect")
        .data([
            {"metaphorType" : "Str", "count" : 0},
            {"metaphorType" : "Ont", "count" : 0},
            {"metaphorType" : "Ori", "count" : 0},
            {"metaphorType" : "Img", "count" : 0},
        ])
        .join("rect")
        .attr("x", 0)
        .attr("y", d => yScaleBar(d.metaphorType))
        .attr("width", d => xScaleBar(d.count))
        .attr("height", 20)
        .attr("fill", function(d,i) {
            return barColors(i);
        })

        // .join("rect")
        //     .attr("x", d => xScale(x1RectAccessor(d)))
        //     .attr("y", d => yScale(y2RectAccessor(d)))
        //     .attr("width", d => xScale(x2RectAccessor(d))-xScale(x1RectAccessor(d)))
        //     .attr("height", d => yScale(y1RectAccessor(d))-yScale(y2RectAccessor(d)))
        //     .attr("rx", 15)
        //     .attr("fill-opacity", 0.3)

}

async function updateBarPlot(barLengths) {
    console.log(barLengths)
    const barBounds = d3.select("#bar-bounds")

    const bars = barBounds.selectAll("rect").data(barLengths)
        .join("rect")
        .transition().duration(400)
        .attr("x", 0)
        .attr("y", d => yScaleBar(d.metaphorType))
        .attr("width", d => xScaleBar(d.count))
        .attr("height", 20)
        .attr("fill", function(d,i) {
            return barColors(i);
        })
        //.attr("fill", "rgb(1, 148, 136)")
}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API