Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

change color of a diagram element which is stored in the server and retrived as JSON format

Posted on 2016-09-14
4
Medium Priority
?
57 Views
Last Modified: 2016-10-04
{
            "type": "vsm.box",
            "name": "VSM Box",
            "bold": true,
            "italic": true,
            "underline": true,
            "size": {
                "width": 100,
                "height": 100
            },
            "description": "Box",
            "position": {
                "x": 120,
                "y": 290
            },
            "angle": 0,
            "id": "b1b65721-ac0b-4687-a081-88b28109cb9b",
            "embeds": "",
            "z": 1,
            "attrs": {
                "rect": {
                    "stroke": "#000000",
                    "stroke-width": 1,
                    "stroke-dasharray": "0"
                },
                "text": {
                    "text": "Box",
                    "font-family": "Arial",
                    "stroke": "#000000",
                    "stroke-width": 0,
                    "font-weight": 400,
                    "font-style": "normal",
                    "text-decoration": ""
                }
            }
        }

Open in new window

This is one of my program element in JSOn now i would like to fill color to it.
accor ding to rappid api if i change coding it is pushed to
attrs---> rect---->fill:color
0
Comment
Question by:Reek Majumder
  • 2
  • 2
4 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points (awarded by participants)
ID: 41799475
Check this:
{
	"type": "vsm.box",
	"name": "VSM Box",
	"bold": true,
	"italic": true,
	"underline": true,
	"size": {
		"width": 100,
		"height": 100
	},
	"description": "Box",
	"position": {
		"x": 120,
		"y": 290
	},
	"angle": 0,
	"id": "b1b65721-ac0b-4687-a081-88b28109cb9b",
	"embeds": "",
	"z": 1,
	"attrs": {
		"rect": {
			"fill":"cornflowerblue",
			"stroke": "#000000",
			"stroke-width": 1,
			"stroke-dasharray": "0"
		},
		"text": {
			"text": "Box",
			"font-family": "Arial",
			"stroke": "#000000",
			"stroke-width": 0,
			"font-weight": 400,
			"font-style": "normal",
			"text-decoration": ""
		}
	}
}

Open in new window

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 41799477
...or the color in hex:
{
	"type": "vsm.box",
	"name": "VSM Box",
	"bold": true,
	"italic": true,
	"underline": true,
	"size": {
		"width": 100,
		"height": 100
	},
	"description": "Box",
	"position": {
		"x": 120,
		"y": 290
	},
	"angle": 0,
	"id": "b1b65721-ac0b-4687-a081-88b28109cb9b",
	"embeds": "",
	"z": 1,
	"attrs": {
		"rect": {
			"fill":"#6495ED",
			"stroke": "#000000",
			"stroke-width": 1,
			"stroke-dasharray": "0"
		},
		"text": {
			"text": "Box",
			"font-family": "Arial",
			"stroke": "#000000",
			"stroke-width": 0,
			"font-weight": 400,
			"font-style": "normal",
			"text-decoration": ""
		}
	}
}

Open in new window

0
 
LVL 34

Expert Comment

by:Slick812
ID: 41799922
greetings Reek Majumder, , It looks like you want to "Change" this fill color in the browser javascript operations that receive the "JSON string" from the server, I guess it uses AJAX to get this "JSON string", it is possible to add the fillcolor property to the rect object in the javascript string, but it may be less difficult to to add the fillcolor property AFTER the "JSON string" is converted to a javascript Object in the code progression. Can you show us the AJAX "JSON string" retrieval  code in the javascript?
0
 
LVL 34

Expert Comment

by:Slick812
ID: 41827710
No comment has been added from the author, so forced closing as abandoned, with best solution presented
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question