From Dark and Darker Wiki

No edit summary
(Undo revision 40884)
Tag: Undo
 
(8 intermediate revisions by the same user not shown)
Line 67: Line 67:
},
},
border: {
border: {
display:false,
color:axisColor
color:axisColor
},
},
Line 107: Line 108:
},
},
border: {
border: {
display:false,
color:axisColor
color:axisColor
},
},
ticks: {
ticks: {
color:fontColor,
color:fontColor,
callback: (label, index, labels) => {
callback: function (val, index, ticks) {
console.log(label)
console.log(val)
return label;
return val%5==0 ? this.getLabelForValue(Number(val)) : undefined;
}
}
}
}

Latest revision as of 08:40, 21 September 2024

Parameters

uniqueId
  • Determines canvas element name
  • Name needs to be unique if multiple widgets are to be displayed on the same page.
title
  • Default: "" empty string
  • String of text to display as the title of the graph.
  • This string also serves to detemine whether or not to show the legend.
    If no string is provided both the legend and the title are not displayed.
yAxisLabel
  • Default: "" empty string
  • String of text to display on the y-axis. Text is rendered vertically, bottom to top.
xAxisLabel
  • Default: "" empty string
  • String of text to display on the x-axis.
gridColor
  • Default: '#80808080'
axisColor
  • Default: var gridColor
fontColor
  • Default: 'white'
datasets
  • String of text that is a properly formatted JSON object when parsed by JSON.parse(). The graph will not render if an improper JSON object is passed.
    It is recommended that you check the string format with some sort of tool like JSON Lint, or whatever else you prefer.
  • The first set of objects within the JSON object must have the "datasets" array pair.


Example

{{#widget:LogDatasetsChart|uniqueId=2Hoardtreasure_HR3|datasets={"labels":[0, "", 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 425, 450, 475, 500],"datasets":[{"label":"2","data":[1.0, 0.84902, 0.739258, 0.657067, 0.592511, 0.541233, 0.498804, 0.46412, 0.434549, 0.409781, 0.388129, 0.369863, 0.353686, 0.339913, 0.327543, 0.317101, 0.307695, 0.299859, 0.29273, 0.286992, 0.281855],"borderColor":"#DEDEDE","backgroundColor":"#DEDEDEAA"},{"label":"3","data":[1.0, 0.859332, 0.758213, 0.682312, 0.623696, 0.577007, 0.539248, 0.508346, 0.482832, 0.461465, 0.443576, 0.428578, 0.416101, 0.405624, 0.397022, 0.390038, 0.384619, 0.380532, 0.377716, 0.376136, 0.375806],"borderColor":"#62BE0B","backgroundColor":"#62BE0BAA"},{"label":"4","data":[1.0, 1.069009, 1.119123, 1.156519, 1.185646, 1.208831, 1.227867, 1.243414, 1.256328, 1.267184, 1.276612, 1.28445, 1.291163, 1.296779, 1.301836, 1.305849, 1.309243, 1.312074, 1.31445, 1.316101, 1.317201],"borderColor":"#4A9BD1","backgroundColor":"#4A9BD1AA"},{"label":"5","data":[1.0, 1.100804, 1.172956, 1.227479, 1.269845, 1.30346, 1.330864, 1.353216, 1.372208, 1.388088, 1.401257, 1.412595, 1.422235, 1.430634, 1.437221, 1.443142, 1.448091, 1.45173, 1.454583, 1.456776, 1.458504],"borderColor":"#AD5AFF","backgroundColor":"#AD5AFFAA"},{"label":"6","data":[1.0, 1.13174, 1.226789, 1.29844, 1.354044, 1.398666, 1.43386, 1.463527, 1.48857, 1.508992, 1.526345, 1.54074, 1.553723, 1.564084, 1.573002, 1.580436, 1.586554, 1.591385, 1.595093, 1.597827, 1.599808],"borderColor":"#F7A22D","backgroundColor":"#F7A22DAA"}]}|title=Luck's Effect on Each Luck Grade|yAxisLabel=Probability at  X  Luck  /  Probability at  0  Luck|xAxisLabel=Luck}}