How to use light effects in ThreeJS editor on added shapes - three.js

I'm quite new on ThreeJS and I read the documentation and followed a lot of tutorials.
I now know how to interact with objects (transform, mouseover, rotation, computation on positions and scales, etc.), but I struggle handling the light. For the moment my scene has 4 elements I added thanks to the "Add > cube" menu. When I play the scene, everything is animated correctly, but the color remains the same: everything is in the #XXXXXX color I set.
What I would like is to have an effect of light and shadow like this: https://threejs.org/docs/#api/en/materials/MeshStandardMaterial
I think I have put every option like in this page. What did I do wrong? Here is my scene:
{
"metadata": {
"version": 4.5,
"type": "Object",
"generator": "Object3D.toJSON"
},
"geometries": [
{
"uuid": "4346FD85-69A5-4085-B397-3CDEA12FBCA1",
"type": "BoxBufferGeometry",
"width": 1.8,
"height": 1.8,
"depth": 1.8,
"widthSegments": 1,
"heightSegments": 1,
"depthSegments": 1
},
{
"uuid": "BCF75EF3-3759-4B20-96E1-720C509A3637",
"type": "SphereBufferGeometry",
"radius": 1,
"widthSegments": 8,
"heightSegments": 6,
"phiStart": 0,
"phiLength": 6.283185,
"thetaStart": 0,
"thetaLength": 3.141593
},
{
"uuid": "44E67ACB-39CB-4562-9BDE-4DB448366ED0",
"type": "DodecahedronBufferGeometry",
"radius": 1.2,
"detail": 0
},
{
"uuid": "F0338DDF-165A-47ED-A094-2537432A503B",
"type": "IcosahedronBufferGeometry",
"radius": 1.5,
"detail": 0
}],
"materials": [
{
"uuid": "388DEE89-D57C-4853-A22D-01554B78FF5B",
"type": "MeshPhongMaterial",
"color": 16777215,
"emissive": 0,
"specular": 1118481,
"shininess": 30,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680
},
{
"uuid": "C9CA005B-89BC-4CD7-A13E-6F18610A2907",
"type": "MeshStandardMaterial",
"color": 16777215,
"roughness": 1,
"metalness": 0,
"emissive": 14869218,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680
},
{
"uuid": "B5419D03-751E-421C-980E-3B004191B7A9",
"type": "MeshStandardMaterial",
"name": "poly2",
"color": 16777215,
"roughness": 1,
"metalness": 0,
"emissive": 10658466,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"skinning": true
},
{
"uuid": "44FC5BB3-405E-4DF1-9018-087E6BCE1DAE",
"type": "MeshStandardMaterial",
"name": "poly3",
"color": 16777215,
"roughness": 1,
"metalness": 0,
"emissive": 7829367,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"skinning": true
}],
"object": {
"uuid": "70493730-BD58-409F-8879-037628764C76",
"type": "Scene",
"name": "Scene",
"userData": {
"souris": [],
"formes": [
"Box",
"Icosahedron",
"Dodecahedron",
"Sphere"]
},
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,-0.04,-5.06,0,1],
"children": [
{
"uuid": "AE0F3376-E0B4-47A2-8EE4-821522A4E7E2",
"type": "Mesh",
"name": "Box",
"userData": {
"position": {
"x": 0,
"y": 7.6,
"z": 0
},
"couleurs": [
"FFFFFF",
"095256"],
"decalage": 0.5
},
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,-0.003758,7.6,0.001485,1],
"geometry": "4346FD85-69A5-4085-B397-3CDEA12FBCA1",
"material": "388DEE89-D57C-4853-A22D-01554B78FF5B"
},
{
"uuid": "68FBB0DB-A517-45DD-AE8D-E414E2B5730B",
"type": "Mesh",
"name": "Sphere",
"userData": {
"position": {
"x": 0,
"y": 1,
"z": 0
},
"couleurs": [
"FFFFFF",
"86A873"],
"decalage": 0.2
},
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1],
"geometry": "BCF75EF3-3759-4B20-96E1-720C509A3637",
"material": "C9CA005B-89BC-4CD7-A13E-6F18610A2907"
},
{
"uuid": "816269B9-8C50-4C7D-80B0-D688F0FFF6D2",
"type": "Mesh",
"name": "Dodecahedron",
"userData": {
"position": {
"x": 0,
"y": 3,
"z": 0
},
"couleurs": [
"FFFFFF",
"5AAA95"],
"decalage": 0.3
},
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,3,0,1],
"geometry": "44E67ACB-39CB-4562-9BDE-4DB448366ED0",
"material": "B5419D03-751E-421C-980E-3B004191B7A9"
},
{
"uuid": "8A74081A-5E4F-46A5-9F9E-75537641605F",
"type": "Mesh",
"name": "Icosahedron",
"userData": {
"position": {
"x": 0,
"y": 5.4,
"z": 0
},
"couleurs": [
"FFFFFF",
"087F8C"],
"decalage": 0.5
},
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,5.4,0,1],
"geometry": "F0338DDF-165A-47ED-A094-2537432A503B",
"material": "44FC5BB3-405E-4DF1-9018-087E6BCE1DAE"
},
{
"uuid": "8666758A-A261-4E55-91DE-6B0B57C2A104",
"type": "AmbientLight",
"name": "AmbientLight",
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,4.700659,1],
"color": 13355979,
"intensity": 0.5
}]
}
}

The problem is that you're using AmbientLight, which doesn't have light or dark sides. It illuminates every face evenly, as if the light is coming from every direction, giving all your geometries a flat appearance. Try using something more exciting, like DirectionalLight, Spotlight, or HemisphereLight to get some shading variation. You could spend some time playing with different lights and reading the docs to see how each light behaves differently. See here to read about AmbientLight.
The second issue is that you're modifying the .emissive property of the material. Adding an emissive color means it will ignore lights, and will just glow on its own. That's why you're getting such flat gray colors. Try instead changing its .color property, which will interact more naturally with the light.
See below, I added a DirectionalLight, removed .emissive, and added different .colors to each shape:

Related

transparent object make behind object NOT render at certain camera position

I am using three.js with transparent objects. For some camera positions, the object which is behind transparent object will NOT be rendered.
Please see video: https://streamable.com/bneg94
To reproduce this, you can use https://threejs.org/editor/, then load attached scene below
{
"metadata": {
"version": 4.5,
"type": "Object",
"generator": "Object3D.toJSON"
},
"geometries": [
{
"uuid": "262dc10a-2eee-41f8-a4c1-4060f291e461",
"type": "BoxGeometry",
"width": 2.95,
"height": 0.02,
"depth": 0.45,
"widthSegments": 1,
"heightSegments": 1,
"depthSegments": 1
},
{
"uuid": "14ba553a-8a8f-4c85-b71e-88a3917928ef",
"type": "BoxGeometry",
"width": 0.2,
"height": 0.2,
"depth": 0.1,
"widthSegments": 1,
"heightSegments": 1,
"depthSegments": 1
}],
"materials": [
{
"uuid": "531c47ff-b7b7-4614-8cf1-b50dbaab12c4",
"type": "MeshStandardMaterial",
"color": 9713720,
"roughness": 1,
"metalness": 0,
"emissive": 0,
"envMapIntensity": 1,
"opacity": 0.6,
"transparent": true,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680
},
{
"uuid": "d942bed5-0292-4fb3-aa5d-48d3a997dcb5",
"type": "MeshStandardMaterial",
"color": 13311,
"roughness": 1,
"metalness": 0,
"emissive": 0,
"envMapIntensity": 1,
"opacity": 0.5,
"transparent": true,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680
}],
"object": {
"uuid": "8C69EB3B-5F72-463E-84DF-83C737DD9A62",
"type": "Scene",
"name": "Scene",
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"children": [
{
"uuid": "A816D365-2535-471E-8DE8-EA3C806770E2",
"type": "AmbientLight",
"name": "AmbientLight",
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"color": 16777215,
"intensity": 0.7
},
{
"uuid": "681f9f5d-2016-4bc6-889d-e01f95311a13",
"type": "DirectionalLight",
"name": "DirectionalLight",
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,5,10,7.5,1],
"color": 16777215,
"intensity": 0.3,
"shadow": {
"camera": {
"uuid": "8d51b8c9-b41e-4472-8d0e-b9bc2ef87ad9",
"type": "OrthographicCamera",
"layers": 1,
"zoom": 1,
"left": -5,
"right": 5,
"top": 5,
"bottom": -5,
"near": 0.5,
"far": 500
}
}
},
{
"uuid": "7ec021f6-ff2c-4bb2-8b14-7e62b602638b",
"type": "Mesh",
"name": "Box",
"frustumCulled": false,
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0.5,0.73,-0.25,1],
"geometry": "262dc10a-2eee-41f8-a4c1-4060f291e461",
"material": "531c47ff-b7b7-4614-8cf1-b50dbaab12c4"
},
{
"uuid": "b2d4bf3f-b3f0-4dd3-aabe-a0b9ecfc621c",
"type": "Mesh",
"name": "Box",
"frustumCulled": false,
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0.6,0.6,-0.15,1],
"geometry": "14ba553a-8a8f-4c85-b71e-88a3917928ef",
"material": "d942bed5-0292-4fb3-aa5d-48d3a997dcb5"
}]
}
}
I searched for solution but all of them can NOT be used. For example, when setting material depthWrite = false, at some certain camera angle, the color is NOT multiplied: https://streamable.com/dbmslo
Do you know any solution to fix this problem?
Thank you for your reading.

Download a PNG from URL LookIntoBitcoin

There is a page with URL:
https://www.lookintobitcoin.com/charts/1-year-hodl-wave/
I'm designing a page and I just want to reference the "image" of this URL.
It has a download PNG file, how can i just get the path/url to this png image file?
Here is the image icon, but i cant figure out how to get the url path to just the png file.
Can anyone show me how to get it?
This image is dynamically generated at client side (browser), so here is two ways to solve your problem:
Use Selenium or PhantomJS (both using headless browser technology) to emulate browser behaviour and automatically "press" download button at background.
Fetch JSON data and create graph by yourself (for example how to create PNG image based on txt file in python)
I recommend second way because it more flexible and you will be able to widely customize result image. But it may be more complicated than headless browser way.
If you want to use second way, you can fetch JSON data using python (for example):
import requests
import json
url = 'https://www.lookintobitcoin.com/django_plotly_dash/app/hodl_wave/_dash-update-component'
request_data = {
"output":"chart.figure",
"changedPropIds":["url.pathname"],
"inputs":[
{
"id":"url",
"property":"pathname",
"value":"/charts/1-year-hodl-wave/"
}
]
}
response = requests.post(url, json=request_data)
print(json.dumps(response.json(), indent=2))
And output will be:
{
"response": {
"props": {
"figure": {
"data": [
{
"line": {
"color": "#003366",
"width": 1.2
},
"name": "BTC Price",
"x": [
"2010-08-17",
"2020-09-13",
"2020-09-14",
...
"2021-09-07",
"2021-09-08"
],
"y": [
0.07,
0.07,
...
46215.0
],
"yaxis": "y2",
"type": "scatter"
},
{
"connectgaps": true,
"line": {
"color": "#ffa500",
"width": 0.8
},
"name": "1Yr+ HODL Wave",
"x": [
"2010-08-17",
...
"2021-12-16T00:00:00",
"2021-12-17T00:00:00"
],
"y": [
0.28032062150000003,
0.2807032645,
...
0.5101534705064048,
0.5090896880670537
],
"yaxis": "y",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(255, 207, 209, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Peak",
"showlegend": true,
"x": [
"2011-06-13"
],
"y": [
20.11
],
"yaxis": "y2",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(255, 207, 209, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Peak",
"showlegend": false,
"x": [
"2011-06-13"
],
"y": [
0.2979442568
],
"yaxis": "y",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(255, 207, 209, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Peak",
"showlegend": false,
"x": [
"2013-12-02"
],
"y": [
1047.9
],
"yaxis": "y2",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(255, 207, 209, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Peak",
"showlegend": false,
"x": [
"2013-12-02"
],
"y": [
0.3877138953
],
"yaxis": "y",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(255, 207, 209, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Peak",
"showlegend": false,
"x": [
"2017-12-20"
],
"y": [
16811.3
],
"yaxis": "y2",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(255, 207, 209, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Peak",
"showlegend": false,
"x": [
"2017-12-20"
],
"y": [
0.43133634880000005
],
"yaxis": "y",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(211, 245, 231, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Bottom",
"showlegend": false,
"x": [
"2011-11-22"
],
"y": [
2.31
],
"yaxis": "y2",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(211, 245, 231, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Bottom",
"showlegend": false,
"x": [
"2011-11-22"
],
"y": [
0.3073864328
],
"yaxis": "y",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(211, 245, 231, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Bottom",
"showlegend": false,
"x": [
"2015-01-17"
],
"y": [
201.75
],
"yaxis": "y2",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(211, 245, 231, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Bottom",
"showlegend": false,
"x": [
"2015-01-17"
],
"y": [
0.5363931366
],
"yaxis": "y",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(211, 245, 231, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Bottom",
"showlegend": true,
"x": [
"2018-12-20"
],
"y": [
3983.01
],
"yaxis": "y2",
"type": "scatter"
},
{
"hoverinfo": "skip",
"marker": {
"color": "rgba(211, 245, 231, 0.75)",
"size": 15
},
"mode": "markers",
"name": "Price Bottom",
"showlegend": false,
"x": [
"2018-12-20"
],
"y": [
0.5097358173
],
"yaxis": "y",
"type": "scatter"
}
],
"layout": {
"hovermode": "closest",
"images": [
{
"layer": "below",
"opacity": 0.1,
"sizex": 0.4,
"sizey": 0.4,
"source": "https://www.lookintobitcoin.com/static/img/logo/logo-stacked.png",
"x": 0.4,
"xref": "paper",
"y": 0.75,
"yref": "paper"
}
],
"legend": {
"font": {
"color": "#696969"
},
"orientation": "h",
"x": 0.1
},
"margin": {
"t": 10
},
"uirevision": "False",
"xaxis": {
"color": "#696969",
"gridcolor": "#d3d3d3",
"hoverformat": "%d-%b-%y",
"range": [
"2010-08-17",
"2021-12-17T00:00:00"
],
"showline": true,
"showspikes": true,
"spikecolor": "#696969",
"spikedash": "solid",
"spikemode": "toaxis+across",
"spikethickness": 1
},
"yaxis": {
"color": "#696969",
"hoverformat": "%",
"range": [
0,
1
],
"showgrid": false,
"showspikes": true,
...
"spikethickness": 1,
"tickformat": "%",
"title": {
"text": "1Yr+ HODL Wave"
}
},
"yaxis2": {
"color": "#696969",
"dtick": 1,
...
"spikethickness": 1,
"ticktext": [
"$0.001",
...
"$10,000",
"$100,000"
],
"tickvals": [
0.001,
...
100000
],
"title": {
"text": "BTC Price (USD)"
},
"type": "log",
"zeroline": true
}
}
}
}
}
}

How do I make the charts c two type: normal and stacked?

I want to have two typecharts in one visual.
Desired example
Current example, Editor
You can use 2 layers having bar chart instead of column. First layer will be a stacked layer in which filter is applied for used and free fields. Second layer can have the total field. Using xOffset you can position both the bar charts. Refer the code below or editor:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"config": {"view": {"stroke": "transparent"}, "axis": {"domainWidth": 1}},
"width": 300,
"data": {
"values": [
{"branch": "V", "free": 300, "used": 800, "total": 1000},
{"branch": "K", "free": 100, "used": 400, "total": 500},
{"branch": "D", "free": 100, "used": 200, "total": 300}
]
},
"transform": [
{"calculate": "[ datum.used, datum.free, datum.total]", "as": "table"},
{"calculate": "['used', 'free', 'total']", "as": "headline"},
{"flatten": ["table", "headline"]},
{
"calculate": "datum.headline +':'+ datum.table + ' ('+round(datum.table *100/ datum.total)+'%)'",
"as": "tooltip"
}
],
"encoding": {
"y": {"aggregate": "sum", "field": "table", "axis": {"grid": false}},
"x": {
"field": "branch",
"axis": {"grid": false, "domain": false, "labelAngle": 0, "ticks": false},
"sort": {"op": "sum", "field": "table", "order": "descending"}
},
"tooltip": {"field": "tooltip", "type": "nominal"},
"color": {
"field": "headline",
"type": "nominal",
"scale": {"range": ["#409b66", "#878787", "#1b5c9e"]}
}
},
"layer": [
{
"transform": [
{"filter": {"field": "headline", "oneOf": ["used", "free"]}}
],
"mark": {"type": "bar", "width": 15, "xOffset": -10}
},
{
"mark": {"type": "bar", "width": 15, "xOffset": 8},
"encoding": {
"y": {"field": "total", "axis": {"grid": false}, "stack": false}
}
}
]
}

About Y-axis scale in amCharts

I am facing problem with scale on vertical axis like 2,4,6,8,10 etc or 5,10,15,20. I have achieved this on one axis (name Iron in ppm) but how to achieve this on second y-axis?
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "light",
"id": "SweepGraph",
"legend": {
"marginTop": 150,
"useGraphSettings": true
},
"synchronizeGrid": synchronizeGridFlag,
"dataProvider": SortedChartData,
"valueAxes": [{
"id": "BaseNumber",
"axisColor": "#0000ff",
"axisThickness": 2,
"axisAlpha": 1,
"position": "right",
"title": "BaseNumber in mgKOH/g",
"minimum" : BaseNumberMinimum,
"maximum": BaseNumberMaximum,
"autoGridCount": false,
"gridCount": 100,
"synchronizationMultiplier": ironLabelFrequency,
"strictMinMax": true,
//"synchronizationMultiplier": BaseNumberLabelFrequency
}, {
"id": "Iron",
"maximum": IronMaximum,
"minimum": IronMinimum,
"minMaxMultiplier": 0,
"precision": 0,
"synchronizationMultiplier": ironLabelFrequency,
"synchronizeWith": "BaseNumber",
"strictMinMax": true,
"axisAlpha": 1,
"axisColor": "#ff0000",
"axisThickness": 2,
"gridCount": 100,
"gridThickness": 0,
"minHorizontalGap": 0,
"minVerticalGap": 0,
"title": "Iron in ppm"
}],
"graphs": AmCharts.parseJSON(graphData),
"chartScrollbar": {},
"chartCursor": {
"cursorPosition": "pointer",
"oneBalloonOnly": true,
"valueZoomable":true
},
"guides":GlobalSweepGuides,
"categoryField": "FeedRate",
"categoryAxis": {
"gridPosition": "start",
"title": "ACC Value in (g/Kw/h)/(%wt)",
"axisColor": "#DADADA",
"minorGridEnabled": true,
"autoGridCount": false,
"gridCount": 12
},
"export": {
"enabled": true,
"menu": [],
"libs": {
"path": "http://www.amcharts.com/lib/3/plugins/export/libs/"
},
"position": "bottom-right"
}
});
Here is jsFiddle url:https://jsfiddle.net/HARSHAD557/jgz289fw/
Please solve this problem.

How can i set max value to 1 and min value to 0 on y-axis for an AmChart?

var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"dataProvider": chartData,
"categoryField": "date",
"categoryAxis": {
"parseDates": false,
"gridAlpha": 0.15,
"minorGridEnabled": true,
"axisColor": "#DADADA",
"title": 'Timp'
},
"valueAxes": [{
"axisAlpha": 0.2,
"id": "v1",
}],
"graphs": [{
"title": "Starea echipamentului",
"id": "g1",
"valueAxis": "v1",
"valueField": "starea",
"autoGridCount": true,
"bullet": "round",
"bulletBorderColor": "#FFFFFF",
"bulletBorderAlpha": 1,
"lineThickness": 2,
"lineColor": "#b5030d",
"negativeLineColor": "#0352b5",
"balloonText": "[[category]]<br><b><span style='font-size:14px;'>value: [[value]]</span></b>",
}],
"titles": [
{
"size": 15,
"text": window.location.href.split('?')[1].split('=')[1].replace('%20',' ')
}
],
"legend": {
"useGraphSettings": true
},
"chartCursor": {
"fullWidth": true,
"cursorAlpha": 0.1
},
"chartScrollbar": {
"scrollbarHeight": 40,
"color": "#FFFFFF",
"autoGridCount": true,
"graph": "g1"
},
"mouseWheelZoomEnabled": true,
"responsive": {
"enabled": true
},
"export": {
"enabled": true,
"libs": {
"path": "http://amcharts.com/lib/3/plugins/export/libs/"
}
}
});
So my graph on y-axis, has only 0, 0.5 and 1 values. If i have part of the graph where i have 0.5 on y-axis it apeears values between 0.5 (0.4 min and 0.6 max). How ever i want my graph on y axis to display 0 and 1, not 1.2 . Any ideas?
Use minimum and maximum properties for the value axis:
"valueAxes": [{
"axisAlpha": 0.2,
"id": "v1",
"minimum": 0,
"maximum": 1
}],
That should do the trick.
In some rare cases, you might also want to set strictMinMax. But for this particular case, you're probably not going to need it.

Resources