Solved

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

Posted on 2016-09-14
4
44 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 500 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
This article discusses four methods for overlaying images in a container on a web page
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

829 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